<!DOCTYPE html>
<html lang="zh-CN">
    <head hexo-theme='https://github.com/volantis-x/hexo-theme-volantis/#5.8.0'>
  <meta name="generator" content="Hexo 6.3.0">
  <meta name="Volantis" content="5.8.0">
  <meta charset="utf-8">
  <!-- SEO相关 -->
  
  <link rel="canonical" href="https://wyzqy.gitee.io/2023/07/07/小程序笔记/"/>
  <!-- 渲染优化 -->
    <meta http-equiv='x-dns-prefetch-control' content='on' />
      <link rel='dns-prefetch' href='https://unpkg.com'>
      <link rel="preconnect" href="https://unpkg.com" crossorigin>
  <meta name="renderer" content="webkit">
  <meta name="force-rendering" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta http-equiv="Content-Security-Policy" content=" default-src 'self' https:; block-all-mixed-content; base-uri 'self' https:; form-action 'self' https:; worker-src 'self' https:; connect-src 'self' https: *; img-src 'self' data: https: *; media-src 'self' https: *; font-src 'self' data: https: *; frame-src 'self' https: *; manifest-src 'self' https: *; child-src https:; script-src 'self' https: 'unsafe-inline' *; style-src 'self' https: 'unsafe-inline' *; ">
  <meta name="HandheldFriendly" content="True" >
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
  <meta content="black-translucent" name="apple-mobile-web-app-status-bar-style">
  <meta content="telephone=no" name="format-detection">
  <!-- import head_begin begin -->
  <!-- import head_begin end -->
  <!-- Custom Files headBegin begin-->
  
  <!-- Custom Files headBegin end-->
  <!-- front-matter head_begin begin -->
  <!-- front-matter head_begin end -->
  <link rel="preload" href="/css/style.css" as="style">
  <link rel="preload" href="https://unpkg.com/volantis-static@0.0.1654736714924/media/fonts/VarelaRound/VarelaRound-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="https://unpkg.com/volantis-static@0.0.1654736714924/media/fonts/UbuntuMono/UbuntuMono-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">

  <!-- feed -->
  <!-- 页面元数据 -->
  <title>小程序笔记 - 小新的记事本</title>
  <meta name="keywords" content="笔记,小程序,null">
  <meta desc name="description" content="原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~ - Mdream - 小新的记事本">
  
<meta property="og:type" content="article">
<meta property="og:title" content="小程序笔记">
<meta property="og:url" content="https://wyzqy.gitee.io/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/index.html">
<meta property="og:site_name" content="小新的记事本">
<meta property="og:description" content="原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png">
<meta property="article:published_time" content="2023-07-07T06:25:00.000Z">
<meta property="article:modified_time" content="2023-07-07T07:29:28.724Z">
<meta property="article:author" content="Mdream">
<meta property="article:tag" content="笔记">
<meta property="article:tag" content="小程序">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png">
  <style>
    /* 首屏样式 */
    #safearea {
  display: none;
}
:root {
  --color-site-body: #f4f4f4;
  --color-site-bg: #f4f4f4;
  --color-site-inner: #fff;
  --color-site-footer: #666;
  --color-card: #fff;
  --color-text: #444;
  --color-block: #f6f6f6;
  --color-inlinecode: #c74f00;
  --color-codeblock: #fff7ea;
  --color-h1: #3a3a3a;
  --color-h2: #3a3a3a;
  --color-h3: #333;
  --color-h4: #444;
  --color-h5: #555;
  --color-h6: #666;
  --color-p: #444;
  --color-list: #666;
  --color-list-hl: #30ad91;
  --color-meta: #888;
  --color-read-bkg: #e0d8c8;
  --color-read-post: #f8f1e2;
  --color-copyright-bkg: #f5f5f5;
}
* {
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  outline: none;
  margin: 0;
  padding: 0;
}
*::-webkit-scrollbar {
  height: 4px;
  width: 4px;
}
*::-webkit-scrollbar-track-piece {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: #3dd9b6;
  cursor: pointer;
  border-radius: 2px;
  -webkit-border-radius: 2px;
}
*::-webkit-scrollbar-thumb:hover {
  background: #ff5722;
}
html {
  color: var(--color-text);
  width: 100%;
  height: 100%;
  font-family: UbuntuMono, "Varela Round", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, Menlo, Monaco, monospace, sans-serif;
  font-size: 16px;
}
html >::-webkit-scrollbar {
  height: 4px;
  width: 4px;
}
html >::-webkit-scrollbar-track-piece {
  background: transparent;
}
html >::-webkit-scrollbar-thumb {
  background: #54b5a0 linear-gradient(45deg, rgba(255,255,255,0.4) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.4) 75%, transparent 75%, transparent);
  cursor: pointer;
  border-radius: 2px;
  -webkit-border-radius: 2px;
}
html >::-webkit-scrollbar-thumb:hover {
  background: #54b5a0 linear-gradient(45deg, rgba(255,255,255,0.4) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.4) 75%, transparent 75%, transparent);
}
body {
  background-color: var(--color-site-body);
  text-rendering: optimizelegibility;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}
body.modal-active {
  overflow: hidden;
}
@media screen and (max-width: 680px) {
  body.modal-active {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }
}
a {
  color: #2092ec;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
a:hover {
  color: #ff5722;
}
a:active,
a:hover {
  outline: 0;
}
ul,
ol {
  padding-left: 0;
}
ul li,
ol li {
  list-style: none;
}
header {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
}
img {
  border: 0;
  background: none;
  max-width: 100%;
}
svg:not(:root) {
  overflow: hidden;
}
hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  height: 0;
  border: 0;
  border-radius: 1px;
  -webkit-border-radius: 1px;
  border-bottom: 1px solid rgba(68,68,68,0.1);
}
button,
input {
  color: inherit;
  font: inherit;
  margin: 0;
}
button {
  overflow: visible;
  text-transform: none;
  -webkit-appearance: button;
  cursor: pointer;
}
@supports (backdrop-filter: blur(20px)) {
  .blur {
    background: rgba(255,255,255,0.9) !important;
    backdrop-filter: saturate(200%) blur(20px);
  }
}
.shadow {
  box-shadow: 0 1px 2px 0px rgba(0,0,0,0.1);
  -webkit-box-shadow: 0 1px 2px 0px rgba(0,0,0,0.1);
}
.shadow.floatable {
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
.shadow.floatable:hover {
  box-shadow: 0 2px 4px 0px rgba(0,0,0,0.1), 0 4px 8px 0px rgba(0,0,0,0.1), 0 8px 16px 0px rgba(0,0,0,0.1);
  -webkit-box-shadow: 0 2px 4px 0px rgba(0,0,0,0.1), 0 4px 8px 0px rgba(0,0,0,0.1), 0 8px 16px 0px rgba(0,0,0,0.1);
}
#l_cover {
  min-height: 64px;
}
.cover-wrapper {
  top: 0;
  left: 0;
  max-width: 100%;
  height: 100vh;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  flex-wrap: nowrap;
  -webkit-flex-wrap: nowrap;
  -khtml-flex-wrap: nowrap;
  -moz-flex-wrap: nowrap;
  -o-flex-wrap: nowrap;
  -ms-flex-wrap: nowrap;
  -webkit-box-direction: normal;
  -moz-box-direction: normal;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  align-items: center;
  align-self: center;
  align-content: center;
  color: var(--color-site-inner);
  padding: 0 16px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: relative;
  overflow: hidden;
  margin-bottom: -100px;
}
.cover-wrapper .cover-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
  -webkit-background-size: cover;
  -moz-background-size: cover;
}
.cover-wrapper .cover-bg.lazyload:not(.loaded) {
  opacity: 0;
  -webkit-opacity: 0;
  -moz-opacity: 0;
}
.cover-wrapper .cover-bg.lazyload.loaded {
  animation-delay: 0s;
  animation-duration: 0.5s;
  animation-fill-mode: forwards;
  animation-timing-function: ease-out;
  animation-name: fadeIn;
}
@-moz-keyframes fadeIn {
  0% {
    opacity: 0;
    -webkit-opacity: 0;
    -moz-opacity: 0;
    filter: blur(12px);
    transform: scale(1.02);
    -webkit-transform: scale(1.02);
    -khtml-transform: scale(1.02);
    -moz-transform: scale(1.02);
    -o-transform: scale(1.02);
    -ms-transform: scale(1.02);
  }
  100% {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@-webkit-keyframes fadeIn {
  0% {
    opacity: 0;
    -webkit-opacity: 0;
    -moz-opacity: 0;
    filter: blur(12px);
    transform: scale(1.02);
    -webkit-transform: scale(1.02);
    -khtml-transform: scale(1.02);
    -moz-transform: scale(1.02);
    -o-transform: scale(1.02);
    -ms-transform: scale(1.02);
  }
  100% {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@-o-keyframes fadeIn {
  0% {
    opacity: 0;
    -webkit-opacity: 0;
    -moz-opacity: 0;
    filter: blur(12px);
    transform: scale(1.02);
    -webkit-transform: scale(1.02);
    -khtml-transform: scale(1.02);
    -moz-transform: scale(1.02);
    -o-transform: scale(1.02);
    -ms-transform: scale(1.02);
  }
  100% {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@keyframes fadeIn {
  0% {
    opacity: 0;
    -webkit-opacity: 0;
    -moz-opacity: 0;
    filter: blur(12px);
    transform: scale(1.02);
    -webkit-transform: scale(1.02);
    -khtml-transform: scale(1.02);
    -moz-transform: scale(1.02);
    -o-transform: scale(1.02);
    -ms-transform: scale(1.02);
  }
  100% {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
.cover-wrapper .cover-body {
  z-index: 1;
  position: relative;
  width: 100%;
  height: 100%;
}
.cover-wrapper#full {
  height: calc(100vh + 100px);
  padding-bottom: 100px;
}
.cover-wrapper#half {
  max-height: 640px;
  min-height: 400px;
  height: calc(36vh - 64px + 200px);
}
.cover-wrapper #scroll-down {
  width: 100%;
  height: 64px;
  position: absolute;
  bottom: 100px;
  text-align: center;
  cursor: pointer;
}
.cover-wrapper #scroll-down .scroll-down-effects {
  color: #fff;
  font-size: 24px;
  line-height: 64px;
  position: absolute;
  width: 24px;
  left: calc(50% - 12px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  animation: scroll-down-effect 1.5s infinite;
  -webkit-animation: scroll-down-effect 1.5s infinite;
  -khtml-animation: scroll-down-effect 1.5s infinite;
  -moz-animation: scroll-down-effect 1.5s infinite;
  -o-animation: scroll-down-effect 1.5s infinite;
  -ms-animation: scroll-down-effect 1.5s infinite;
}
@-moz-keyframes scroll-down-effect {
  0% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
  50% {
    top: -16px;
    opacity: 0.4;
    -webkit-opacity: 0.4;
    -moz-opacity: 0.4;
  }
  100% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@-webkit-keyframes scroll-down-effect {
  0% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
  50% {
    top: -16px;
    opacity: 0.4;
    -webkit-opacity: 0.4;
    -moz-opacity: 0.4;
  }
  100% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@-o-keyframes scroll-down-effect {
  0% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
  50% {
    top: -16px;
    opacity: 0.4;
    -webkit-opacity: 0.4;
    -moz-opacity: 0.4;
  }
  100% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@keyframes scroll-down-effect {
  0% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
  50% {
    top: -16px;
    opacity: 0.4;
    -webkit-opacity: 0.4;
    -moz-opacity: 0.4;
  }
  100% {
    top: 0;
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
.cover-wrapper .cover-body {
  margin-top: 64px;
  margin-bottom: 100px;
}
.cover-wrapper .cover-body,
.cover-wrapper .cover-body .top,
.cover-wrapper .cover-body .bottom {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  -webkit-box-direction: normal;
  -moz-box-direction: normal;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-justify-content: center;
  -khtml-justify-content: center;
  -moz-justify-content: center;
  -o-justify-content: center;
  -ms-justify-content: center;
  max-width: 100%;
}
.cover-wrapper .cover-body .bottom {
  margin-top: 32px;
}
.cover-wrapper .cover-body .title {
  font-family: "Varela Round", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, Helvetica, monospace;
  font-size: 3.125rem;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.cover-wrapper .cover-body .subtitle {
  font-size: 20px;
}
.cover-wrapper .cover-body .logo {
  max-height: 120px;
  max-width: calc(100% - 4 * 16px);
}
@media screen and (min-height: 1024px) {
  .cover-wrapper .cover-body .title {
    font-size: 3rem;
  }
  .cover-wrapper .cover-body .subtitle {
    font-size: 1.05rem;
  }
  .cover-wrapper .cover-body .logo {
    max-height: 150px;
  }
}
.cover-wrapper .cover-body .m_search {
  position: relative;
  max-width: calc(100% - 16px);
  width: 320px;
  vertical-align: middle;
}
.cover-wrapper .cover-body .m_search .form {
  position: relative;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  width: 100%;
}
.cover-wrapper .cover-body .m_search .icon,
.cover-wrapper .cover-body .m_search .input {
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
.cover-wrapper .cover-body .m_search .icon {
  position: absolute;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  line-height: 2.5rem;
  width: 32px;
  top: 0;
  left: 5px;
  color: rgba(68,68,68,0.75);
}
.cover-wrapper .cover-body .m_search .input {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  height: 2.5rem;
  width: 100%;
  box-shadow: none;
  -webkit-box-shadow: none;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  font-size: 0.875rem;
  -webkit-appearance: none;
  padding-left: 36px;
  border-radius: 1.4rem;
  -webkit-border-radius: 1.4rem;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  border: none;
  color: var(--color-text);
}
@media screen and (max-width: 500px) {
  .cover-wrapper .cover-body .m_search .input {
    padding-left: 36px;
  }
}
.cover-wrapper .cover-body .m_search .input:hover {
  background: rgba(255,255,255,0.8);
}
.cover-wrapper .cover-body .m_search .input:focus {
  background: #fff;
}
.cover-wrapper .list-h {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  -webkit-box-direction: normal;
  -moz-box-direction: normal;
  -webkit-box-orient: horizontal;
  -moz-box-orient: horizontal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
  flex-wrap: wrap;
  -webkit-flex-wrap: wrap;
  -khtml-flex-wrap: wrap;
  -moz-flex-wrap: wrap;
  -o-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  align-items: stretch;
  border-radius: 4px;
  -webkit-border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.cover-wrapper .list-h a {
  -webkit-box-flex: 1;
  -moz-box-flex: 1;
  -webkit-flex: 1 0;
  -ms-flex: 1 0;
  flex: 1 0;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  font-weight: 600;
}
.cover-wrapper .list-h a img {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  border-radius: 2px;
  -webkit-border-radius: 2px;
  margin: 4px;
  min-width: 40px;
  max-width: 44px;
}
@media screen and (max-width: 768px) {
  .cover-wrapper .list-h a img {
    min-width: 36px;
    max-width: 40px;
  }
}
@media screen and (max-width: 500px) {
  .cover-wrapper .list-h a img {
    margin: 2px 4px;
    min-width: 32px;
    max-width: 36px;
  }
}
@media screen and (max-width: 375px) {
  .cover-wrapper .list-h a img {
    min-width: 28px;
    max-width: 32px;
  }
}
.cover-wrapper {
  max-width: 100%;
}
.cover-wrapper.search .bottom .menu {
  margin-top: 16px;
}
.cover-wrapper.search .bottom .menu .list-h a {
  white-space: nowrap;
  -webkit-box-direction: normal;
  -moz-box-direction: normal;
  -webkit-box-orient: horizontal;
  -moz-box-orient: horizontal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
  align-items: baseline;
  padding: 2px;
  margin: 4px;
  color: var(--color-site-inner);
  opacity: 0.75;
  -webkit-opacity: 0.75;
  -moz-opacity: 0.75;
  text-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-bottom: 2px solid transparent;
}
.cover-wrapper.search .bottom .menu .list-h a i {
  margin-right: 4px;
}
.cover-wrapper.search .bottom .menu .list-h a p {
  font-size: 0.9375rem;
}
.cover-wrapper.search .bottom .menu .list-h a:hover,
.cover-wrapper.search .bottom .menu .list-h a.active,
.cover-wrapper.search .bottom .menu .list-h a:active {
  opacity: 1;
  -webkit-opacity: 1;
  -moz-opacity: 1;
  border-bottom: 2px solid var(--color-site-inner);
}
@font-face {
  font-family: 'UbuntuMono';
  src: url("https://unpkg.com/volantis-static@0.0.1654736714924/media/fonts/UbuntuMono/UbuntuMono-Regular.ttf");
  font-weight: 'normal';
  font-style: 'normal';
  font-display: swap;
}
@font-face {
  font-family: 'Varela Round';
  src: url("https://unpkg.com/volantis-static@0.0.1654736714924/media/fonts/VarelaRound/VarelaRound-Regular.ttf");
  font-weight: 'normal';
  font-style: 'normal';
  font-display: swap;
}
.l_header {
  position: fixed;
  z-index: 1000;
  top: 0;
  width: 100%;
  height: 64px;
  background: var(--color-card);
  box-shadow: 0 1px 2px 0px rgba(0,0,0,0.1);
  -webkit-box-shadow: 0 1px 2px 0px rgba(0,0,0,0.1);
}
.l_header.auto {
  transition: opacity 0.4s ease;
  -webkit-transition: opacity 0.4s ease;
  -khtml-transition: opacity 0.4s ease;
  -moz-transition: opacity 0.4s ease;
  -o-transition: opacity 0.4s ease;
  -ms-transition: opacity 0.4s ease;
  visibility: hidden;
}
.l_header.auto.show {
  opacity: 1 !important;
  -webkit-opacity: 1 !important;
  -moz-opacity: 1 !important;
  visibility: visible;
}
.l_header .container {
  margin-left: 16px;
  margin-right: 16px;
}
.l_header #wrapper {
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.l_header #wrapper .nav-main,
.l_header #wrapper .nav-sub {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  flex-wrap: nowrap;
  -webkit-flex-wrap: nowrap;
  -khtml-flex-wrap: nowrap;
  -moz-flex-wrap: nowrap;
  -o-flex-wrap: nowrap;
  -ms-flex-wrap: nowrap;
  justify-content: space-between;
  -webkit-justify-content: space-between;
  -khtml-justify-content: space-between;
  -moz-justify-content: space-between;
  -o-justify-content: space-between;
  -ms-justify-content: space-between;
  align-items: center;
}
.l_header #wrapper .nav-main {
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
.l_header #wrapper.sub .nav-main {
  transform: translateY(-64px);
  -webkit-transform: translateY(-64px);
  -khtml-transform: translateY(-64px);
  -moz-transform: translateY(-64px);
  -o-transform: translateY(-64px);
  -ms-transform: translateY(-64px);
}
.l_header #wrapper .nav-sub {
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
  opacity: 0;
  -webkit-opacity: 0;
  -moz-opacity: 0;
  height: 64px;
  width: calc(100% - 2 * 16px);
  position: absolute;
}
.l_header #wrapper .nav-sub ::-webkit-scrollbar {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
}
@media screen and (min-width: 2048px) {
  .l_header #wrapper .nav-sub {
    max-width: 55vw;
    margin: auto;
  }
}
.l_header #wrapper.sub .nav-sub {
  opacity: 1;
  -webkit-opacity: 1;
  -moz-opacity: 1;
}
.l_header #wrapper .title {
  position: relative;
  color: var(--color-text);
  padding-left: 24px;
  max-height: 64px;
}
.l_header #wrapper .nav-main .title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  line-height: 64px;
  padding: 0 24px;
  font-size: 1.25rem;
  font-family: "Varela Round", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, Helvetica, monospace;
}
.l_header #wrapper .nav-main .title img {
  height: 64px;
}
.l_header .nav-sub {
  max-width: 1080px;
  margin: auto;
}
.l_header .nav-sub .title {
  font-weight: bold;
  font-family: UbuntuMono, "Varela Round", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, Menlo, Monaco, monospace, sans-serif;
  line-height: 1.2;
  max-height: 64px;
  white-space: normal;
  flex-shrink: 1;
}
.l_header .switcher {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
  line-height: 64px;
  align-items: center;
}
.l_header .switcher .s-toc {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
}
@media screen and (max-width: 768px) {
  .l_header .switcher .s-toc {
    display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
    display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
    display: -ms-flexbox /* TWEENER - IE 10 */;
    display: -webkit-flex /* NEW - Chrome */;
    display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
    display: flex;
  }
}
.l_header .switcher >li {
  height: 48px;
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
  margin: 2px;
}
@media screen and (max-width: 500px) {
  .l_header .switcher >li {
    margin: 0 1px;
    height: 48px;
  }
}
.l_header .switcher >li >a {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  justify-content: center;
  -webkit-justify-content: center;
  -khtml-justify-content: center;
  -moz-justify-content: center;
  -o-justify-content: center;
  -ms-justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  padding: 0.85em 1.1em;
  border-radius: 100px;
  -webkit-border-radius: 100px;
  border: none;
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
  color: #3dd9b6;
}
.l_header .switcher >li >a:hover {
  border: none;
}
.l_header .switcher >li >a.active,
.l_header .switcher >li >a:active {
  border: none;
  background: var(--color-site-bg);
}
@media screen and (max-width: 500px) {
  .l_header .switcher >li >a {
    width: 36px;
    height: 48px;
  }
}
.l_header .nav-sub .switcher {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
}
.l_header .m_search {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  height: 64px;
  width: 240px;
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
@media screen and (max-width: 1024px) {
  .l_header .m_search {
    width: 44px;
    min-width: 44px;
  }
  .l_header .m_search input::placeholder {
    opacity: 0;
    -webkit-opacity: 0;
    -moz-opacity: 0;
  }
  .l_header .m_search:hover {
    width: 240px;
  }
  .l_header .m_search:hover input::placeholder {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@media screen and (min-width: 500px) {
  .l_header .m_search:hover .input {
    width: 100%;
  }
  .l_header .m_search:hover .input::placeholder {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
@media screen and (max-width: 500px) {
  .l_header .m_search {
    min-width: 0;
  }
  .l_header .m_search input::placeholder {
    opacity: 1;
    -webkit-opacity: 1;
    -moz-opacity: 1;
  }
}
.l_header .m_search .form {
  position: relative;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  width: 100%;
  align-items: center;
}
.l_header .m_search .icon {
  position: absolute;
  width: 36px;
  left: 5px;
  color: var(--color-meta);
}
@media screen and (max-width: 500px) {
  .l_header .m_search .icon {
    display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
    display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
    display: none;
  }
}
.l_header .m_search .input {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.3;
  width: 100%;
  color: var(--color-text);
  background: #fafafa;
  box-shadow: none;
  -webkit-box-shadow: none;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  padding-left: 40px;
  font-size: 0.875rem;
  border-radius: 8px;
  -webkit-border-radius: 8px;
  border: none;
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
@media screen and (min-width: 500px) {
  .l_header .m_search .input:focus {
    box-shadow: 0 4px 8px 0px rgba(0,0,0,0.1);
    -webkit-box-shadow: 0 4px 8px 0px rgba(0,0,0,0.1);
  }
}
@media screen and (max-width: 500px) {
  .l_header .m_search .input {
    background: var(--color-block);
    padding-left: 8px;
    border: none;
  }
  .l_header .m_search .input:hover,
  .l_header .m_search .input:focus {
    border: none;
  }
}
@media (max-width: 500px) {
  .l_header .m_search {
    left: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    background: #fff;
    transition: all 0.28s ease;
    -webkit-transition: all 0.28s ease;
    -khtml-transition: all 0.28s ease;
    -moz-transition: all 0.28s ease;
    -o-transition: all 0.28s ease;
    -ms-transition: all 0.28s ease;
  }
  .l_header .m_search .input {
    border-radius: 32px;
    -webkit-border-radius: 32px;
    margin-left: 16px;
    padding-left: 16px;
  }
  .l_header.z_search-open .m_search {
    width: 100%;
  }
  .l_header.z_search-open .m_search .input {
    width: calc(100% - 120px);
  }
}
ul.m-pc >li>a {
  color: inherit;
  border-bottom: 2px solid transparent;
}
ul.m-pc >li>a:active,
ul.m-pc >li>a.active {
  border-bottom: 2px solid #3dd9b6;
}
ul.m-pc li:hover >ul.list-v,
ul.list-v li:hover >ul.list-v {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
}
ul.nav-list-h {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: -ms-flexbox /* TWEENER - IE 10 */;
  display: -webkit-flex /* NEW - Chrome */;
  display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
  display: flex;
  align-items: stretch;
}
ul.nav-list-h>li {
  position: relative;
  justify-content: center;
  -webkit-justify-content: center;
  -khtml-justify-content: center;
  -moz-justify-content: center;
  -o-justify-content: center;
  -ms-justify-content: center;
  height: 100%;
  line-height: 2.4;
  border-radius: 4px;
  -webkit-border-radius: 4px;
}
ul.nav-list-h>li >a {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 600;
}
ul.list-v {
  z-index: 1;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
  position: absolute;
  background: var(--color-card);
  box-shadow: 0 2px 4px 0px rgba(0,0,0,0.08), 0 4px 8px 0px rgba(0,0,0,0.08), 0 8px 16px 0px rgba(0,0,0,0.08);
  -webkit-box-shadow: 0 2px 4px 0px rgba(0,0,0,0.08), 0 4px 8px 0px rgba(0,0,0,0.08), 0 8px 16px 0px rgba(0,0,0,0.08);
  margin-top: -6px;
  border-radius: 4px;
  -webkit-border-radius: 4px;
  padding: 8px 0;
}
ul.list-v.show {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
}
ul.list-v hr {
  margin-top: 8px;
  margin-bottom: 8px;
}
ul.list-v >li {
  white-space: nowrap;
  word-break: keep-all;
}
ul.list-v >li.header {
  font-size: 0.78125rem;
  font-weight: bold;
  line-height: 2em;
  color: var(--color-meta);
  margin: 8px 16px 4px;
}
ul.list-v >li.header i {
  margin-right: 8px;
}
ul.list-v >li ul {
  margin-left: 0;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
  margin-top: -40px;
}
ul.list-v .aplayer-container {
  min-height: 64px;
  padding: 6px 16px;
}
ul.list-v >li>a {
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  color: var(--color-list);
  font-size: 0.875rem;
  font-weight: bold;
  line-height: 36px;
  padding: 0 20px 0 16px;
  text-overflow: ellipsis;
  margin: 0 4px;
  border-radius: 4px;
  -webkit-border-radius: 4px;
}
@media screen and (max-width: 1024px) {
  ul.list-v >li>a {
    line-height: 40px;
  }
}
ul.list-v >li>a >i {
  margin-right: 8px;
}
ul.list-v >li>a:active,
ul.list-v >li>a.active {
  color: var(--color-list-hl);
}
ul.list-v >li>a:hover {
  color: var(--color-list-hl);
  background: var(--color-site-bg);
}
.l_header .menu >ul>li>a {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: block;
  padding: 0 8px;
}
.l_header .menu >ul>li>a >i {
  margin-right: 4px;
}
.l_header ul.nav-list-h>li {
  color: var(--color-list);
  line-height: 64px;
}
.l_header ul.nav-list-h>li >a {
  max-height: 64px;
  overflow: hidden;
  color: inherit;
}
.l_header ul.nav-list-h>li >a:active,
.l_header ul.nav-list-h>li >a.active {
  color: #3dd9b6;
}
.l_header ul.nav-list-h>li:hover>a {
  color: var(--color-list-hl);
}
.l_header ul.nav-list-h>li i.music {
  animation: rotate-effect 1.5s linear infinite;
  -webkit-animation: rotate-effect 1.5s linear infinite;
  -khtml-animation: rotate-effect 1.5s linear infinite;
  -moz-animation: rotate-effect 1.5s linear infinite;
  -o-animation: rotate-effect 1.5s linear infinite;
  -ms-animation: rotate-effect 1.5s linear infinite;
}
@-moz-keyframes rotate-effect {
  0% {
    transform: rotate(0);
    -webkit-transform: rotate(0);
    -khtml-transform: rotate(0);
    -moz-transform: rotate(0);
    -o-transform: rotate(0);
    -ms-transform: rotate(0);
  }
  25% {
    transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    -khtml-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
  }
  50% {
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -khtml-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
  }
  75% {
    transform: rotate(270deg);
    -webkit-transform: rotate(270deg);
    -khtml-transform: rotate(270deg);
    -moz-transform: rotate(270deg);
    -o-transform: rotate(270deg);
    -ms-transform: rotate(270deg);
  }
  100% {
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -khtml-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
  }
}
@-webkit-keyframes rotate-effect {
  0% {
    transform: rotate(0);
    -webkit-transform: rotate(0);
    -khtml-transform: rotate(0);
    -moz-transform: rotate(0);
    -o-transform: rotate(0);
    -ms-transform: rotate(0);
  }
  25% {
    transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    -khtml-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
  }
  50% {
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -khtml-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
  }
  75% {
    transform: rotate(270deg);
    -webkit-transform: rotate(270deg);
    -khtml-transform: rotate(270deg);
    -moz-transform: rotate(270deg);
    -o-transform: rotate(270deg);
    -ms-transform: rotate(270deg);
  }
  100% {
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -khtml-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
  }
}
@-o-keyframes rotate-effect {
  0% {
    transform: rotate(0);
    -webkit-transform: rotate(0);
    -khtml-transform: rotate(0);
    -moz-transform: rotate(0);
    -o-transform: rotate(0);
    -ms-transform: rotate(0);
  }
  25% {
    transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    -khtml-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
  }
  50% {
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -khtml-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
  }
  75% {
    transform: rotate(270deg);
    -webkit-transform: rotate(270deg);
    -khtml-transform: rotate(270deg);
    -moz-transform: rotate(270deg);
    -o-transform: rotate(270deg);
    -ms-transform: rotate(270deg);
  }
  100% {
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -khtml-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
  }
}
@keyframes rotate-effect {
  0% {
    transform: rotate(0);
    -webkit-transform: rotate(0);
    -khtml-transform: rotate(0);
    -moz-transform: rotate(0);
    -o-transform: rotate(0);
    -ms-transform: rotate(0);
  }
  25% {
    transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    -khtml-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
  }
  50% {
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -khtml-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
  }
  75% {
    transform: rotate(270deg);
    -webkit-transform: rotate(270deg);
    -khtml-transform: rotate(270deg);
    -moz-transform: rotate(270deg);
    -o-transform: rotate(270deg);
    -ms-transform: rotate(270deg);
  }
  100% {
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -khtml-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
  }
}
.menu-phone li ul.list-v {
  right: calc(100% - 0.5 * 16px);
}
.menu-phone li ul.list-v ul {
  right: calc(100% - 0.5 * 16px);
}
#wrapper {
  max-width: 1080px;
  margin: auto;
}
@media screen and (min-width: 2048px) {
  #wrapper {
    max-width: 55vw;
  }
}
#wrapper .menu {
  -webkit-box-flex: 1;
  -moz-box-flex: 1;
  -webkit-flex: 1 1;
  -ms-flex: 1 1;
  flex: 1 1;
  margin: 0 16px 0 0;
}
#wrapper .menu .list-v ul {
  left: calc(100% - 0.5 * 16px);
}
.menu-phone {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
  margin-top: 16px;
  right: 8px;
  transition: all 0.28s ease;
  -webkit-transition: all 0.28s ease;
  -khtml-transition: all 0.28s ease;
  -moz-transition: all 0.28s ease;
  -o-transition: all 0.28s ease;
  -ms-transition: all 0.28s ease;
}
.menu-phone ul {
  right: calc(100% - 0.5 * 16px);
}
@media screen and (max-width: 500px) {
  .menu-phone {
    display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
    display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
    display: block;
  }
}
.l_header {
  max-width: 65vw;
  left: calc((100% - 65vw) * 0.5);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}
@media screen and (max-width: 2048px) {
  .l_header {
    max-width: 1112px;
    left: calc((100% - 1112px) * 0.5);
  }
}
@media screen and (max-width: 1112px) {
  .l_header {
    left: 0;
    border-radius: 0;
    -webkit-border-radius: 0;
    max-width: 100%;
  }
}
@media screen and (max-width: 500px) {
  .l_header .container {
    margin-left: 0;
    margin-right: 0;
  }
  .l_header #wrapper .nav-main .title {
    padding-left: 16px;
    padding-right: 16px;
  }
  .l_header #wrapper .nav-sub {
    width: 100%;
  }
  .l_header #wrapper .nav-sub .title {
    overflow-y: scroll;
    margin-top: 2px;
    padding: 8px 16px;
  }
  .l_header #wrapper .switcher {
    display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
    display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
    display: -ms-flexbox /* TWEENER - IE 10 */;
    display: -webkit-flex /* NEW - Chrome */;
    display: flex /* NEW, Spec - Opera 12.1, Firefox 20+ */;
    display: flex;
    margin-right: 8px;
  }
  .l_header .menu {
    display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
    display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
    display: none;
  }
}
@media screen and (max-width: 500px) {
  .list-v li {
    max-width: 270px;
  }
}
#u-search {
  display: -webkit-box /* OLD - iOS 6-, Safari 3.1-6 */;
  display: -moz-box /* OLD - Firefox 19- (buggy but mostly works) */;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 60px 20px;
  z-index: 1001;
}
@media screen and (max-width: 680px) {
  #u-search {
    padding: 0px;
  }
}

  </style>
  <link rel="stylesheet" href="/css/style.css" media="print" onload="this.media='all';this.onload=null">
  <noscript><link rel="stylesheet" href="/css/style.css"></noscript>
  
<script>
if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMode))
    document.write(
	'<style>'+
		'html{'+
			'overflow-x: hidden !important;'+
			'overflow-y: hidden !important;'+
		'}'+
		'.kill-ie{'+
			'text-align:center;'+
			'height: 100%;'+
			'margin-top: 15%;'+
			'margin-bottom: 5500%;'+
		'}'+
    '.kill-t{'+
      'font-size: 2rem;'+
    '}'+
    '.kill-c{'+
      'font-size: 1.2rem;'+
    '}'+
		'#l_header,#l_body{'+
			'display: none;'+
		'}'+
	'</style>'+
    '<div class="kill-ie">'+
        `<span class="kill-t"><b>抱歉，您的浏览器无法访问本站</b></span><br/>`+
        `<span class="kill-c">微软已经于2016年终止了对 Internet Explorer (IE) 10 及更早版本的支持，<br/>继续使用存在极大的安全隐患，请使用当代主流的浏览器进行访问。</span><br/>`+
        `<a target="_blank" rel="noopener" href="https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/"><strong>了解详情 ></strong></a>`+
    '</div>');
</script>


<noscript>
	<style>
		html{
			overflow-x: hidden !important;
			overflow-y: hidden !important;
		}
		.kill-noscript{
			text-align:center;
			height: 100%;
			margin-top: 15%;
			margin-bottom: 5500%;
		}
    .kill-t{
      font-size: 2rem;
    }
    .kill-c{
      font-size: 1.2rem;
    }
		#l_header,#l_body{
			display: none;
		}
	</style>
    <div class="kill-noscript">
        <span class="kill-t"><b>抱歉，您的浏览器无法访问本站</b></span><br/>
        <span class="kill-c">本页面需要浏览器支持（启用）JavaScript</span><br/>
        <a target="_blank" rel="noopener" href="https://www.baidu.com/s?wd=启用JavaScript"><strong>了解详情 ></strong></a>
    </div>
</noscript>


  <script>
  /************这个文件存放不需要重载的全局变量和全局函数*********/
  window.volantis = {}; // volantis 全局变量
  volantis.debug = "env"; // 调试模式
  volantis.dom = {}; // 页面Dom see: /source/js/app.js etc.

  volantis.GLOBAL_CONFIG ={
    debug: "env",
    cdn: {"js":{"app":"/js/app.js","parallax":"/js/plugins/parallax.js","rightMenu":"/js/plugins/rightMenu.js","rightMenus":"/js/plugins/rightMenus.js","sites":"/js/plugins/tags/sites.js","friends":"/js/plugins/tags/friends.js","contributors":"/js/plugins/tags/contributors.js","search":"/js/search/hexo.js"},"css":{"style":"/css/style.css"}},
    default: {"avatar":"https://unpkg.com/volantis-static@0.0.1654736714924/media/placeholder/avatar/round/3442075.svg","link":"https://unpkg.com/volantis-static@0.0.1654736714924/media/placeholder/link/8f277b4ee0ecd.svg","cover":"https://unpkg.com/volantis-static@0.0.1654736714924/media/placeholder/cover/76b86c0226ffd.svg","image":"https://unpkg.com/volantis-static@0.0.1654736714924/media/placeholder/image/2659360.svg"},
    lastupdate: new Date(1706453282818),
    sidebar: {
      for_page: ["blogger","category","tagcloud"],
      for_post: ["toc"],
      webinfo: {
        lastupd: {
          enable: true,
          friendlyShow: true
        },
        runtime: {
          data: "2023/5/10",
          unit: "天"
        }
      }
    },
    plugins: {
      message: {"enable":true,"css":"https://unpkg.com/volantis-static@0.0.1654736714924/libs/izitoast/dist/css/iziToast.min.css","js":"https://unpkg.com/volantis-static@0.0.1654736714924/libs/izitoast/dist/js/iziToast.min.js","icon":{"default":"fa-solid fa-info-circle light-blue","quection":"fa-solid fa-question-circle light-blue"},"time":{"default":5000,"quection":20000},"position":"topRight","transitionIn":"bounceInLeft","transitionOut":"fadeOutRight","titleColor":"var(--color-text)","messageColor":"var(--color-text)","backgroundColor":"var(--color-card)","zindex":2147483647,"copyright":{"enable":true,"title":"知识共享许可协议","message":"请遵守 CC BY-NC-SA 4.0 协议。","icon":"far fa-copyright light-blue"},"aplayer":{"enable":true,"play":"fa-solid fa-play","pause":"fa-solid fa-pause"},"rightmenu":{"enable":true,"notice":true}},
      fancybox: {"css":"https://unpkg.com/volantis-static@0.0.1654736714924/libs/@fancyapps/ui/dist/fancybox.css","js":"https://unpkg.com/volantis-static@0.0.1654736714924/libs/@fancyapps/ui/dist/fancybox.umd.js"},
      
      aplayer: {
        id: 3175833810,
        enable:true
      },
      
      
      
    }
  }

  /******************** volantis.EventListener ********************************/
  // 事件监听器 see: /source/js/app.js
  volantis.EventListener = {}
  // 这里存放pjax切换页面时将被移除的事件监听器
  volantis.EventListener.list = []
  //构造方法
  function volantisEventListener(type, f, ele) {
    this.type = type
    this.f = f
    this.ele = ele
  }
  // 移除事件监听器
  volantis.EventListener.remove = () => {
    volantis.EventListener.list.forEach(function (i) {
      i.ele.removeEventListener(i.type, i.f, false)
    })
    volantis.EventListener.list = []
  }
  /******************** volantis.dom.$ ********************************/
  // 注：这里没有选择器，也没有forEach一次只处理一个dom，这里重新封装主题常用的dom方法，返回的是dom对象，对象包含了以下方法，同时保留dom的原生API
  function volantisDom(ele) {
    if (!ele) ele = document.createElement("div")
    this.ele = ele;
    // ==============================================================
    this.ele.find = (c) => {
      let q = this.ele.querySelector(c)
      if (q)
        return new volantisDom(q)
    }
    // ==============================================================
    this.ele.hasClass = (c) => {
      return this.ele.className.match(new RegExp('(\\s|^)' + c + '(\\s|$)'));
    }
    this.ele.addClass = (c) => {
      this.ele.classList.add(c);
      return this.ele
    }
    this.ele.removeClass = (c) => {
      this.ele.classList.remove(c);
      return this.ele
    }
    this.ele.toggleClass = (c) => {
      if (this.ele.hasClass(c)) {
        this.ele.removeClass(c)
      } else {
        this.ele.addClass(c)
      }
      return this.ele
    }
    // ==============================================================
    // 参数 r 为 true 表示pjax切换页面时事件监听器将被移除，false不移除
    this.ele.on = (c, f, r = 1) => {
      this.ele.addEventListener(c, f, false)
      if (r) {
        volantis.EventListener.list.push(new volantisEventListener(c, f, this.ele))
      }
      return this.ele
    }
    this.ele.click = (f, r) => {
      this.ele.on("click", f, r)
      return this.ele
    }
    this.ele.scroll = (f, r) => {
      this.ele.on("scroll", f, r)
      return this.ele
    }
    // ==============================================================
    this.ele.html = (c) => {
      // if(c=== undefined){
      //   return this.ele.innerHTML
      // }else{
      this.ele.innerHTML = c
      return this.ele
      // }
    }
    // ==============================================================
    this.ele.hide = (c) => {
      this.ele.style.display = "none"
      return this.ele
    }
    this.ele.show = (c) => {
      this.ele.style.display = "block"
      return this.ele
    }
    // ==============================================================
    return this.ele
  }
  volantis.dom.$ = (ele) => {
    return !!ele ? new volantisDom(ele) : null;
  }
  /******************** RunItem ********************************/
  function RunItem() {
    this.list = []; // 存放回调函数
    this.start = () => {
      for (var i = 0; i < this.list.length; i++) {
        this.list[i].run();
      }
    };
    this.push = (fn, name, setRequestAnimationFrame = true) => {
      let myfn = fn
      if (setRequestAnimationFrame) {
        myfn = ()=>{
          volantis.requestAnimationFrame(fn)
        }
      }
      var f = new Item(myfn, name);
      this.list.push(f);
    };
    this.remove = (name) =>{
      for (let index = 0; index < this.list.length; index++) {
        const e = this.list[index];
        if (e.name == name) {
          this.list.splice(index,1);
        }
      }
    }
    // 构造一个可以run的对象
    function Item(fn, name) {
      // 函数名称
      this.name = name || fn.name;
      // run方法
      this.run = () => {
        try {
          fn()
        } catch (error) {
          console.log(error);
        }
      };
    }
  }
  /******************** Pjax ********************************/
  // /layout/_plugins/pjax/index.ejs
  // volantis.pjax.send(callBack[,"callBackName"]) 传入pjax:send回调函数
  // volantis.pjax.push(callBack[,"callBackName"]) 传入pjax:complete回调函数
  // volantis.pjax.error(callBack[,"callBackName"]) 传入pjax:error回调函数
  volantis.pjax = {};
  volantis.pjax.method = {
    complete: new RunItem(),
    error: new RunItem(),
    send: new RunItem(),
  };
  volantis.pjax = Object.assign(volantis.pjax, {
    push: volantis.pjax.method.complete.push,
    error: volantis.pjax.method.error.push,
    send: volantis.pjax.method.send.push,
  });
  /******************** RightMenu ********************************/
  // volantis.rightmenu.handle(callBack[,"callBackName"]) 外部菜单项控制
  // 可在 volantis.mouseEvent 处获取右键事件
  volantis.rightmenu = {};
  volantis.rightmenu.method = {
    handle: new RunItem(),
  }
  volantis.rightmenu = Object.assign(volantis.rightmenu, {
    handle: volantis.rightmenu.method.handle.push,
  });
  /********************  Dark Mode  ********************************/
  // /layout/_partial/scripts/darkmode.ejs
  // volantis.dark.mode 当前模式 dark or light
  // volantis.dark.toggle() 暗黑模式触发器
  // volantis.dark.push(callBack[,"callBackName"]) 传入触发器回调函数
  volantis.dark = {};
  volantis.dark.method = {
    toggle: new RunItem(),
  };
  volantis.dark = Object.assign(volantis.dark, {
    push: volantis.dark.method.toggle.push,
  });
  /********************  Message  ********************************/
  // VolantisApp.message
  /********************  isMobile  ********************************/
  // /source/js/app.js
  // volantis.isMobile
  // volantis.isMobileOld
  /********************脚本动态加载函数********************************/
  // volantis.js(src, cb)  cb 可以传入onload回调函数 或者 JSON对象 例如: volantis.js("src", ()=>{}) 或 volantis.js("src", {defer:true,onload:()=>{}})
  // volantis.css(src)

  // 返回Promise对象，如下方法同步加载资源，这利于处理文件资源之间的依赖关系，例如：APlayer 需要在 MetingJS 之前加载
  // (async () => {
  //     await volantis.js("...theme.plugins.aplayer.js.aplayer...")
  //     await volantis.js("...theme.plugins.aplayer.js.meting...")
  // })();

  // 已经加入了setTimeout
  volantis.js = (src, cb) => {
    return new Promise(resolve => {
      setTimeout(function () {
        var HEAD = document.getElementsByTagName("head")[0] || document.documentElement;
        var script = document.createElement("script");
        script.setAttribute("type", "text/javascript");
        if (cb) {
          if (JSON.stringify(cb)) {
            for (let p in cb) {
              if (p == "onload") {
                script[p] = () => {
                  cb[p]()
                  resolve()
                }
              } else {
                script[p] = cb[p]
                script.onload = resolve
              }
            }
          } else {
            script.onload = () => {
              cb()
              resolve()
            };
          }
        } else {
          script.onload = resolve
        }
        script.setAttribute("src", src);
        HEAD.appendChild(script);
      });
    });
  }
  volantis.css = (src) => {
    return new Promise(resolve => {
      setTimeout(function () {
        var link = document.createElement('link');
        link.rel = "stylesheet";
        link.href = src;
        link.onload = resolve;
        document.getElementsByTagName("head")[0].appendChild(link);
      });
    });
  }
  /********************按需加载的插件********************************/
  // volantis.import.jQuery().then(()=>{})
  volantis.import = {
    jQuery: () => {
      if (typeof jQuery == "undefined") {
        return volantis.js("https://unpkg.com/volantis-static@0.0.1654736714924/libs/jquery/dist/jquery.min.js")
      } else {
        return new Promise(resolve => {
          resolve()
        });
      }
    }
  }
  /********************** requestAnimationFrame ********************************/
  // 1、requestAnimationFrame 会把每一帧中的所有 DOM 操作集中起来，在一次重绘或回流中就完成，并且重绘或回流的时间间隔紧紧跟随浏览器的刷新频率，一般来说，这个频率为每秒60帧。
  // 2、在隐藏或不可见的元素中，requestAnimationFrame 将不会进行重绘或回流，这当然就意味着更少的的 cpu，gpu 和内存使用量。
  volantis.requestAnimationFrame = (fn)=>{
    if (!window.requestAnimationFrame) {
      window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame;
    }
    window.requestAnimationFrame(fn)
  }
  /************************ layoutHelper *****************************************/
  volantis.layoutHelper = (helper, html, opt)=>{
    opt = Object.assign({clean:false, pjax:true}, opt)
    function myhelper(helper, html, clean) {
      volantis.tempDiv = document.createElement("div");
      volantis.tempDiv.innerHTML = html;
      let layoutHelper = document.querySelector("#layoutHelper-"+helper)
      if (layoutHelper) {
        if (clean) {
          layoutHelper.innerHTML = ""
        }
        layoutHelper.append(volantis.tempDiv);
      }
    }
    myhelper(helper, html, opt.clean)
    if (opt.pjax) {
      volantis.pjax.push(()=>{
        myhelper(helper, html, opt.clean)
      },"layoutHelper-"+helper)
    }
  }
  /****************************** 滚动事件处理 ****************************************/
  volantis.scroll = {
    engine: new RunItem(),
    unengine: new RunItem(),
  };
  volantis.scroll = Object.assign(volantis.scroll, {
    push: volantis.scroll.engine.push,
  });
  // 滚动条距离顶部的距离
  volantis.scroll.getScrollTop = () =>{
    let scrollPos;
    if (window.pageYOffset) {
      scrollPos = window.pageYOffset;
    } else if (document.compatMode && document.compatMode != 'BackCompat') {
      scrollPos = document.documentElement.scrollTop;
    } else if (document.body) {
      scrollPos = document.body.scrollTop;
    }
    return scrollPos;
  }
  // 使用 requestAnimationFrame 处理滚动事件
  // `volantis.scroll.del` 中存储了一个数值, 该数值检测一定时间间隔内滚动条滚动的位移, 数值的检测频率是浏览器的刷新频率. 数值为正数时, 表示向下滚动. 数值为负数时, 表示向上滚动.
  volantis.scroll.handleScrollEvents = () => {
    volantis.scroll.lastScrollTop = volantis.scroll.getScrollTop()
    function loop() {
      const scrollTop = volantis.scroll.getScrollTop();
      if (volantis.scroll.lastScrollTop !== scrollTop) {
        volantis.scroll.del = scrollTop - volantis.scroll.lastScrollTop;
        volantis.scroll.lastScrollTop = scrollTop;
        // if (volantis.scroll.del > 0) {
        //   console.log("向下滚动");
        // } else {
        //   console.log("向上滚动");
        // }
        // 注销过期的unengine未滚动事件
        volantis.scroll.unengine.list=[]
        volantis.scroll.engine.start();
      }else{
        volantis.scroll.unengine.start();
      }
      volantis.requestAnimationFrame(loop)
    }
    volantis.requestAnimationFrame(loop)
  }
  volantis.scroll.handleScrollEvents()
  volantis.scroll.ele = null;
  // 触发页面滚动至目标元素位置
  volantis.scroll.to = (ele, option = {}) => {
    if (!ele) return;
    volantis.scroll.ele = ele;
    // 默认配置
    opt = {
      top: ele.getBoundingClientRect().top + document.documentElement.scrollTop,
      behavior: "smooth"
    }
    // 定义配置
    if ("top" in option) {
      opt.top = option.top
    }
    if ("behavior" in option) {
      opt.behavior = option.behavior
    }
    if ("addTop" in option) {
      opt.top += option.addTop
    }
    if (!("observerDic" in option)) {
      option.observerDic = 100
    }
    // 滚动
    window.scrollTo(opt);
    // 监视器
    // 监视并矫正元素滚动到指定位置
    // 用于处理 lazyload 引起的 cls 导致的定位失败问题
    // option.observer = false
    if (option.observer) {
      setTimeout(() => {
        if (volantis.scroll.ele != ele) {
          return
        }
        volantis.scroll.unengine.push(() => {
          let me = ele.getBoundingClientRect().top
          if(!(me >= -option.observerDic && me <= option.observerDic)){
            volantis.scroll.to(ele, option)
          }
          volantis.scroll.unengine.remove("unengineObserver")
        },"unengineObserver")
      },1000)
    }
  }
  /********************** Content Visibility ********************************/
  // 见 source/css/first.styl 如果遇到任何问题 删除 .post-story 即可
  // 一个元素被声明 content-visibility 属性后 如果元素不在 viewport 中 浏览器不会计算其后代元素样式和属性 从而节省 Style & Layout 耗时
  // content-visibility 的副作用: 锚点失效 等等(实验初期 暂不明确), 使用此方法清除样式
  volantis.cleanContentVisibility = ()=>{
    if (document.querySelector(".post-story")) {
      console.log("cleanContentVisibility");
      document.querySelectorAll(".post-story").forEach(e=>{
        e.classList.remove("post-story")
      })
    }
  }
  /******************************************************************************/
  /******************************************************************************/
  /******************************************************************************/
  //图像加载出错时的处理
  function errorImgAvatar(img) {
    img.src = "https://unpkg.com/volantis-static@0.0.1654736714924/media/placeholder/avatar/round/3442075.svg";
    img.onerror = null;
  }
  function errorImgCover(img) {
    img.src = "https://unpkg.com/volantis-static@0.0.1654736714924/media/placeholder/cover/76b86c0226ffd.svg";
    img.onerror = null;
  }
  /******************************************************************************/
</script>

  <!-- import head_end begin -->
  <!-- import head_end end -->
  <!-- Custom Files headEnd begin-->
  
  <!-- Custom Files headEnd end-->
  <!-- front-matter head_end begin -->
  <!-- front-matter head_end end -->
</head>
  <body itemscope itemtype="http://schema.org/WebPage">
    <!-- import body_begin begin-->
    <!-- import body_begin end-->
    <!-- Custom Files bodyBegin begin-->
    
    <!-- Custom Files bodyBegin end-->
    <!-- front-matter body_begin begin -->
    <!-- front-matter body_begin end -->
    <header itemscope itemtype="http://schema.org/WPHeader" id="l_header" class="l_header auto shadow floatable blur show" style='opacity: 0' >
  <div class='container'>
  <div id='wrapper'>
    <div class='nav-sub'>
      <p class="title"></p>
      <ul class='switcher nav-list-h m-phone' id="pjax-header-nav-list">
        <li><a id="s-comment" class="fa-solid fa-comments fa-fw" target="_self"  href="/" onclick="return false;" title="comment"></a></li>
        
          <li><a id="s-toc" class="s-toc fa-solid fa-list fa-fw" target="_self"  href="/" onclick="return false;" title="toc"></a></li>
        
      </ul>
    </div>
		<div class="nav-main">
      
        
        <a class="title flat-box" target="_self" href='/'>
          
            <img no-lazy class='logo' src='https://w.wqdream.vip/hexo/hb.jpg'/>
          
          
          
        </a>
      

			<div class='menu navigation'>
				<ul class='nav-list-h m-pc'>
          
          
          
            
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/" title="博客"
                  
                  
                  
                    active-action="action-home"
                  >
                  <i class='fa-solid fa-book fa-fw'></i>博客
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/categories/" title="分类"
                  
                  
                  
                    active-action="action-categories"
                  >
                  <i class='fa-solid fa-folder-open fa-fw'></i>分类
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/tags/" title="标签"
                  
                  
                  
                    active-action="action-tags"
                  >
                  <i class='fa-solid fa-tags fa-fw'></i>标签
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/archives/" title="归档"
                  
                  
                  
                    active-action="action-archives"
                  >
                  <i class='fa-solid fa-archive fa-fw'></i>归档
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/friends/" title="友链"
                  
                  
                  
                    active-action="action-friends"
                  >
                  <i class='fa-solid fa-link fa-fw'></i>友链
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/about/" title="关于"
                  
                  
                  
                    active-action="action-about"
                  >
                  <i class='fa-solid fa-thumbs-up fa-fw'></i>关于
                </a>
                
              </li>
            
          
          
				</ul>
			</div>
      
      <div class="m_search">
        <form name="searchform" class="form u-search-form">
          <i class="icon fa-solid fa-search fa-fw"></i>
          <input type="text" class="input u-search-input" placeholder="搜索一下吧..." />
        </form>
      </div>
      

			<ul class='switcher nav-list-h m-phone'>
				
					<li><a class="s-search fa-solid fa-search fa-fw" target="_self" href="/" onclick="return false;" title="search"></a></li>
				
				<li>
          <a class="s-menu fa-solid fa-bars fa-fw" target="_self" href="/" onclick="return false;" title="menu"></a>
          <ul class="menu-phone list-v navigation white-box">
            
              
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/" title="博客"
                  
                  
                  
                    active-action="action-home"
                  >
                  <i class='fa-solid fa-book fa-fw'></i>博客
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/categories/" title="分类"
                  
                  
                  
                    active-action="action-categories"
                  >
                  <i class='fa-solid fa-folder-open fa-fw'></i>分类
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/tags/" title="标签"
                  
                  
                  
                    active-action="action-tags"
                  >
                  <i class='fa-solid fa-tags fa-fw'></i>标签
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/archives/" title="归档"
                  
                  
                  
                    active-action="action-archives"
                  >
                  <i class='fa-solid fa-archive fa-fw'></i>归档
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/friends/" title="友链"
                  
                  
                  
                    active-action="action-friends"
                  >
                  <i class='fa-solid fa-link fa-fw'></i>友链
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="menuitem flat-box faa-parent animated-hover"
                href="/about/" title="关于"
                  
                  
                  
                    active-action="action-about"
                  >
                  <i class='fa-solid fa-thumbs-up fa-fw'></i>关于
                </a>
                
              </li>
            
          
            
          </ul>
        </li>
			</ul>

      <!-- Custom Files header begin -->
      
      <!-- Custom Files header end -->
		</div>
	</div>
  </div>
</header>

    <div id="l_body">
      <div id="l_cover">
  
    
      <!-- see: /layout/_partial/scripts/_ctrl/coverCtrl.ejs -->
      <div id="none" class='cover-wrapper post search' style="display: none;">
        
  <div class='cover-bg lazyload placeholder' data-bg="https://w.wqdream.vip/hexo/bg.png"></div>

<div class='cover-body'>
  <div class='top'>
    
    
      <p class="title">小新的记事本</p>
    
    
      <p class="subtitle">小新</p>
    
  </div>
  <div class='bottom'>
    
      <div class="m_search">
        <form name="searchform" class="form u-search-form">
          <input type="text" class="input u-search-input" placeholder="搜索" />
          <i class="icon fa-solid fa-search fa-fw"></i>
        </form>
      </div>
    
    <div class='menu navigation'>
      <div class='list-h'>
        
          
            <a href="/"
              
              
              active-action="action-home">
              <p>主页</p>
            </a>
          
            <a href="/categories/"
              
              
              active-action="action-categories">
              <p>分类</p>
            </a>
          
            <a href="/tags/"
              
              
              active-action="action-tags">
              <p>标签</p>
            </a>
          
            <a href="/archives/"
              
              
              active-action="action-archives">
              <p>归档</p>
            </a>
          
            <a href="/friends/"
              
              
              active-action="action-friends">
              <p>友链</p>
            </a>
          
            <a href="/about/"
              
              
              active-action="action-about">
              <p>关于</p>
            </a>
          
        
      </div>
    </div>
  </div>
</div>

        <div id="scroll-down" style="display: none;"><i class="fa fa-chevron-down scroll-down-effects"></i></div>
      </div>
    
  
</div>

      <div id="safearea">
        <div class="body-wrapper">
          
<div id="l_main" class=''>
  <article itemscope itemtype="http://schema.org/Article" class="article post white-box reveal md shadow floatable blur article-type-post" id="post" itemscope itemprop="blogPost">
  <link itemprop="mainEntityOfPage" href="https://wyzqy.gitee.io/2023/07/07/小程序笔记/">
  <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="小新的记事本">
  </span>
  <span hidden itemprop="post" itemscope itemtype="http://schema.org/Post">
    <meta itemprop="name" content="小新的记事本">
    <meta itemprop="description" content="前端技术爱好者">
  </span>
  


  
    <span hidden>
      <meta itemprop="image" content="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png">
    </span>
  
  <div class="article-meta" id="top">
    
    
    
      <h1 class="title" itemprop="name headline">
        小程序笔记
      </h1>
      <div class='new-meta-box'>
        
          
            
<div class='new-meta-item author' itemprop="author" itemscope itemtype="http://schema.org/Person">
  <a itemprop="url" class='author' href="/" rel="nofollow">
    <img itemprop="image" src="https://w.wqdream.vip/hexo/hb.jpg" class="lazyload" data-srcset="https://w.wqdream.vip/hexo/hb.jpg" srcset="">
    <p itemprop="name">小新</p>
  </a>
</div>

          
        
          
            
  <div class='new-meta-item category'>
    <i class="fa-solid fa-folder-open fa-fw" aria-hidden="true"></i>
    <a class="category-link" href="/categories/%E7%AC%94%E8%AE%B0/">笔记</a>
    
      <span hidden itemprop="about" itemscope itemtype="http://schema.org/Thing">
        <a href="/categories/%E7%AC%94%E8%AE%B0/" itemprop="url"><span itemprop="name">笔记</span></a>
      </span>
    
  </div>


          
        
          
            <div class="new-meta-item date" itemprop="dateCreated datePublished" datetime="2023-07-07T14:25:00+08:00">
  <a class='notlink'>
    <i class="fa-solid fa-calendar-alt fa-fw" aria-hidden="true"></i>
    <p>发布于：2023年7月7日</p>
  </a>
</div>

          
        
          
            



          
        
        <!-- Custom Files topMeta begin-->
        
        <!-- Custom Files topMeta end-->
      </div>
    
  </div>


  <div id="layoutHelper-page-plugins"></div>
  <div id="post-body" itemprop="articleBody">
    <p>原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~</p>
<span id="more"></span>

<h1 id="小程序笔记"><a href="#小程序笔记" class="headerlink" title="小程序笔记"></a>小程序笔记</h1><h2 id="一、账号的注册与工具下载"><a href="#一、账号的注册与工具下载" class="headerlink" title="一、账号的注册与工具下载"></a>一、账号的注册与工具下载</h2><p>注册地址|  <a target="_blank" rel="noopener" href="https://mp.weixin.qq.com/">https://mp.weixin.qq.com/</a><br>登录后拿到 APPId （开发—》开发设置）</p>
<p>工具下载地址|  <a target="_blank" rel="noopener" href="https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html">https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html</a></p>
<h2 id="二、项目结构"><a href="#二、项目结构" class="headerlink" title="二、项目结构"></a>二、项目结构</h2><ul>
<li>pages<ul>
<li>用于存放所有小程序页面</li>
</ul>
</li>
<li>utils<ul>
<li>用于存放工具函数的地方</li>
</ul>
</li>
<li>app.js<ul>
<li>小程序项目的入口文件</li>
</ul>
</li>
<li>app.json<ul>
<li>小程序项目的全局配置文件</li>
</ul>
</li>
<li>app.wxss<ul>
<li>小程序项目的全局样式文件</li>
</ul>
</li>
<li>project.config.json<ul>
<li>项目的配置文件</li>
</ul>
</li>
<li>sitemap.json<ul>
<li>用来配置小程序及其他页面是否允许被微信索引</li>
</ul>
</li>
</ul>
<h3 id="2-1、小程序页面的组成部分"><a href="#2-1、小程序页面的组成部分" class="headerlink" title="2.1、小程序页面的组成部分"></a>2.1、小程序页面的组成部分</h3><p>建议把页面放入pages目录中，以单独的文件夹存在，作用如下图<br><img src="https://w.wqdream.vip/lifeIMG/image-20230415121207773.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230415121207773.png" srcset="" alt="image-20230415121207773"><img src="https://w.wqdream.vip/lifeIMG/image-20230415121344690.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230415121344690.png" srcset="" alt="image-20230415121344690"></p>
<h3 id="2-2、JSON配置文件"><a href="#2-2、JSON配置文件" class="headerlink" title="2.2、JSON配置文件"></a>2.2、JSON配置文件</h3><p> <img src="https://w.wqdream.vip/lifeIMG/image-20230415121746346.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230415121746346.png" srcset="" alt="image-20230415121746346"></p>
<h4 id="2-2-1、app-json-文件"><a href="#2-2-1、app-json-文件" class="headerlink" title="2.2.1、app.json 文件"></a>2.2.1、app.json 文件</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230415122115274.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230415122115274.png" srcset="" alt="image-20230415122115274"></p>
<h4 id="2-2-2、project-config-json文件"><a href="#2-2-2、project-config-json文件" class="headerlink" title="2.2.2、project.config.json文件"></a>2.2.2、project.config.json文件</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230415235101337.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230415235101337.png" srcset="" alt="image-20230415235101337"></p>
<h4 id="2-2-3、sitemap-json-文件"><a href="#2-2-3、sitemap-json-文件" class="headerlink" title="2.2.3、sitemap.json 文件"></a>2.2.3、sitemap.json 文件</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230415235444557.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230415235444557.png" srcset="" alt="image-20230415235444557"></p>
<h4 id="2-2-4、页面的-json-文件"><a href="#2-2-4、页面的-json-文件" class="headerlink" title="2.2.4、页面的 .json 文件"></a>2.2.4、页面的 <code>.json</code> 文件</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416000759627.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416000759627.png" srcset="" alt="image-20230416000759627"></p>
<h2 id="三、页面相关"><a href="#三、页面相关" class="headerlink" title="三、页面相关"></a>三、页面相关</h2><h3 id="3-1、新建一个小程序页面"><a href="#3-1、新建一个小程序页面" class="headerlink" title="3.1、新建一个小程序页面"></a>3.1、新建一个小程序页面</h3><p>只需要在全局的 <strong>app.json</strong> 文件中配置路基即可，保存后系统会自动创建</p>
<h3 id="3-2、-修改小程序首页"><a href="#3-2、-修改小程序首页" class="headerlink" title="3.2、 修改小程序首页"></a>3.2、 修改小程序首页</h3><p>把全局的 <strong>app.json</strong> 文件中的文件路径进行修改。谁排第一个谁就是首页</p>
<h3 id="3-3、WXML-和-HTML-的区别"><a href="#3-3、WXML-和-HTML-的区别" class="headerlink" title="3.3、WXML 和 HTML 的区别"></a>3.3、WXML 和 HTML 的区别</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416002251074.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416002251074.png" srcset="" alt="image-20230416002251074"></p>
<h3 id="3-4、WXSS和CSS的区别"><a href="#3-4、WXSS和CSS的区别" class="headerlink" title="3.4、WXSS和CSS的区别"></a>3.4、WXSS和CSS的区别</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416002500259.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416002500259.png" srcset="" alt="image-20230416002500259"></p>
<h3 id="3-5、小程序中-JS-文件的分类"><a href="#3-5、小程序中-JS-文件的分类" class="headerlink" title="3.5、小程序中 .JS 文件的分类"></a>3.5、小程序中 <strong>.JS</strong> 文件的分类</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416002907040.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416002907040.png" srcset="" alt="image-20230416002907040"></p>
<h2 id="四、组件"><a href="#四、组件" class="headerlink" title="四、组件"></a>四、组件</h2><h3 id="4-1、常用的视图组件"><a href="#4-1、常用的视图组件" class="headerlink" title="4.1、常用的视图组件"></a>4.1、常用的视图组件</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416161940524.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416161940524.png" srcset="" alt="image-20230416161940524"></p>
<h3 id="4-2、swiper常用属性"><a href="#4-2、swiper常用属性" class="headerlink" title="4.2、swiper常用属性"></a>4.2、swiper常用属性</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416164221462.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416164221462.png" srcset="" alt="image-20230416164221462"></p>
<h3 id="4-3-text和rich-text"><a href="#4-3-text和rich-text" class="headerlink" title="4.3 text和rich-text"></a>4.3 text和rich-text</h3><p>text为文本，相当于 html 中的span</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">// selectable 可实现长按复制</span><br><span class="line">&lt;text selectable&gt;</span><br><span class="line">   手机号长按可复制：17399373422</span><br><span class="line"> &lt;/text&gt;</span><br></pre></td></tr></table></figure>

<p>rich-text，可实现解析html标签</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">// 解析html标签</span><br><span class="line">rich-text nodes=&quot;&lt;h1 style=&#x27;color:red&#x27;&gt;66&lt;/h1&gt;&quot;/&gt;</span><br></pre></td></tr></table></figure>



<h3 id="4-4-button组件"><a href="#4-4-button组件" class="headerlink" title="4.4 button组件"></a>4.4 button组件</h3><p>通过open-type 属性可以调用微信提供的各种功能（客服、转发、获取用户授权、获取用户信息等）</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230416165744377.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416165744377.png" srcset="" alt="image-20230416165744377"></p>
<h3 id="4-5、image组件"><a href="#4-5、image组件" class="headerlink" title="4.5、image组件"></a>4.5、image组件</h3><p>image组件默认宽 300px    高240px</p>
<h4 id="4-5-1、image组件的-mode-属性"><a href="#4-5-1、image组件的-mode-属性" class="headerlink" title="4.5.1、image组件的 mode 属性"></a>4.5.1、image组件的 mode 属性</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416170716718.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416170716718.png" srcset="" alt="image-20230416170716718"></p>
<h3 id="4-6、navigator组件"><a href="#4-6、navigator组件" class="headerlink" title="4.6、navigator组件"></a>4.6、navigator组件</h3><ul>
<li>页面导航组件</li>
<li>类似于html中的 a 链接</li>
</ul>
<h2 id="五、API"><a href="#五、API" class="headerlink" title="五、API"></a>五、API</h2><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416171458569.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416171458569.png" srcset="" alt="image-20230416171458569"></p>
<h2 id="六、数据绑定以及渲染"><a href="#六、数据绑定以及渲染" class="headerlink" title="六、数据绑定以及渲染"></a>六、数据绑定以及渲染</h2><h3 id="6-1、数据绑定"><a href="#6-1、数据绑定" class="headerlink" title="6.1、数据绑定"></a>6.1、数据绑定</h3><p>和vue中的双向数据绑定一样，只需要在<code>.js</code> 文件中的<code>data</code> 中去声明就可以在 <code>.WXML</code> 中使用 <code> &#123;&#123;&#125;&#125;</code>  去渲染</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">Page(&#123;</span><br><span class="line">	data: &#123;</span><br><span class="line">		info:&#x27;hello world&#x27;,</span><br><span class="line">		imageSrc: &#x27;http://www.6666.com&#x27;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;)</span><br><span class="line">// 例：</span><br><span class="line">&#123;&#123;info&#125;&#125;</span><br><span class="line"></span><br><span class="line">// 绑定属性</span><br><span class="line">// 和 vue 稍有区别</span><br><span class="line">&lt;image src=&quot;&#123;&#123;imageSrc&#125;&#125;&quot;&gt;&lt;/image&gt;</span><br></pre></td></tr></table></figure>



<h3 id="6-2、-事件绑定"><a href="#6-2、-事件绑定" class="headerlink" title="6.2、 事件绑定"></a>6.2、 事件绑定</h3><h4 id="6-2-1-常用的事件"><a href="#6-2-1-常用的事件" class="headerlink" title="6.2.1 常用的事件"></a>6.2.1 常用的事件</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416195216290.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416195216290.png" srcset="" alt="image-20230416195216290"></p>
<h4 id="6-2-2-、event事件"><a href="#6-2-2-、event事件" class="headerlink" title="6.2.2 、event事件"></a>6.2.2 、event事件</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416224645899.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416224645899.png" srcset="" alt="image-20230416224645899"></p>
<p><strong>target 和 currentTarget 组件的区别</strong></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230416224855787.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416224855787.png" srcset="" alt="image-20230416224855787"></p>
<h4 id="6-2-3、为data中的-属性赋值"><a href="#6-2-3、为data中的-属性赋值" class="headerlink" title="6.2.3、为data中的 属性赋值"></a>6.2.3、为data中的 属性赋值</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416225918463.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416225918463.png" srcset="" alt="image-20230416225918463"></p>
<h4 id="6-2-4、事件传参"><a href="#6-2-4、事件传参" class="headerlink" title="6.2.4、事件传参"></a>6.2.4、事件传参</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416230458981.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416230458981.png" srcset="" alt="image-20230416230458981"></p>
<p>通过 <code> e.target.dataset.参数名</code> 来拿到 这个传递过来的参数</p>
<h4 id="6-2-5、bindinput"><a href="#6-2-5、bindinput" class="headerlink" title="6.2.5、bindinput"></a>6.2.5、bindinput</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416232143057.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416232143057.png" srcset="" alt="image-20230416232143057"></p>
<h3 id="6-3、条件渲染"><a href="#6-3、条件渲染" class="headerlink" title="6.3、条件渲染"></a>6.3、条件渲染</h3><h4 id="6-3-1wx-if"><a href="#6-3-1wx-if" class="headerlink" title="6.3.1wx:if"></a>6.3.1<strong>wx:if</strong></h4><p>类似于vue中的 v-if</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230416234030064.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416234030064.png" srcset="" alt="image-20230416234030064"></p>
<p>如果想一次性判断多个组件，可以使用 <block> 标签进行包裹，然后再用wx:if 进行判断</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230416234631025.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416234631025.png" srcset="" alt="image-20230416234631025"></p>
<h4 id="6-3-2、hidden"><a href="#6-3-2、hidden" class="headerlink" title="6.3.2、hidden"></a>6.3.2、hidden</h4><p>类似于vue中的 v-show</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230416234836856.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416234836856.png" srcset="" alt="image-20230416234836856"></p>
<h3 id="6-4、循环（wx-for）"><a href="#6-4、循环（wx-for）" class="headerlink" title="6.4、循环（wx:for）"></a>6.4、循环（wx:for）</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230416235527888.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230416235527888.png" srcset="" alt="image-20230416235527888"></p>
<p><strong>手动修改索引和当前项的变量名</strong></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230417001550117.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230417001550117.png" srcset="" alt="image-20230417001550117"></p>
<p>wx:key</p>
<p>wx:key&#x3D;”id”</p>
<p>不需要 <code> &#123;&#123;&#125;&#125;</code></p>
<h2 id="七、WXSS"><a href="#七、WXSS" class="headerlink" title="七、WXSS"></a>七、WXSS</h2><h3 id="7-1-rpx"><a href="#7-1-rpx" class="headerlink" title="7.1 rpx"></a>7.1 rpx</h3><p>rpx 的实现原理非常简单：鉴于不同设备屏幕的大小不同，为了实现屏幕的自动适配，rpx把所有设备的屏幕在宽度上等分为750份（即：当前屏幕的总宽度为750rpx）</p>
<h3 id="7-2-样式导入"><a href="#7-2-样式导入" class="headerlink" title="7.2 样式导入"></a>7.2 样式导入</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230417161446793.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230417161446793.png" srcset="" alt="image-20230417161446793"></p>
<h2 id="八、全局配置（app-json）"><a href="#八、全局配置（app-json）" class="headerlink" title="八、全局配置（app.json）"></a>八、全局配置（app.json）</h2><h3 id="8-1-Window节点"><a href="#8-1-Window节点" class="headerlink" title="8.1.Window节点"></a>8.1.Window节点</h3><p>可以 修改navigationBar和background（背景区域）</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230417180548878.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230417180548878.png" srcset="" alt="image-20230417180548878"></p>
<h3 id="8-2Window节点常用配置项"><a href="#8-2Window节点常用配置项" class="headerlink" title="8.2Window节点常用配置项"></a>8.2Window节点常用配置项</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230417180800947.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230417180800947.png" srcset="" alt="image-20230417180800947"></p>
<h3 id="8-3下拉刷新"><a href="#8-3下拉刷新" class="headerlink" title="8.3下拉刷新"></a>8.3下拉刷新</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230417190459423.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230417190459423.png" srcset="" alt="image-20230417190459423"></p>
<p><em><strong>下拉刷新背景颜色</strong></em></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230417191334418.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230417191334418.png" srcset="" alt="image-20230417191334418"></p>
<h3 id="8-3-tabBar"><a href="#8-3-tabBar" class="headerlink" title="8.3 tabBar"></a>8.3 tabBar</h3><h4 id="8-3-1-tabBar的组成部分"><a href="#8-3-1-tabBar的组成部分" class="headerlink" title="8.3.1 tabBar的组成部分"></a>8.3.1 tabBar的组成部分</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418013106554.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418013106554.png" srcset="" alt="image-20230418013106554"></p>
<h4 id="8-3-2-tabBar节点的配置项"><a href="#8-3-2-tabBar节点的配置项" class="headerlink" title="8.3.2 tabBar节点的配置项"></a>8.3.2 tabBar节点的配置项</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418013235741.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418013235741.png" srcset="" alt="image-20230418013235741"></p>
<h4 id="8-3-3-每个tab页签中（list数组中存在的）"><a href="#8-3-3-每个tab页签中（list数组中存在的）" class="headerlink" title="8.3.3 每个tab页签中（list数组中存在的）"></a>8.3.3 每个tab页签中（list数组中存在的）</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418013453313.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418013453313.png" srcset="" alt="image-20230418013453313"></p>
<h2 id="九、网络数据请求"><a href="#九、网络数据请求" class="headerlink" title="九、网络数据请求"></a>九、网络数据请求</h2><h3 id="9-1-配置-request-合法域名"><a href="#9-1-配置-request-合法域名" class="headerlink" title="9.1 配置 request 合法域名"></a>9.1 配置 request 合法域名</h3><p>小程序后台–》开发管理—》开发设置—》服务器域名</p>
<h3 id="9-2-发送GET请求和POST请求（区别就在于method中）"><a href="#9-2-发送GET请求和POST请求（区别就在于method中）" class="headerlink" title="9.2 发送GET请求和POST请求（区别就在于method中）"></a>9.2 发送GET请求和POST请求（区别就在于method中）</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418114540649.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418114540649.png" srcset="" alt="image-20230418114540649"></p>
<h3 id="9-3-页面一加载就请求数据"><a href="#9-3-页面一加载就请求数据" class="headerlink" title="9.3 页面一加载就请求数据"></a>9.3 页面一加载就请求数据</h3><p>在onLoad中调用请求数据的方法</p>
<h3 id=""><a href="#" class="headerlink" title=""></a><img src="https://w.wqdream.vip/lifeIMG/image-20230418114900816.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418114900816.png" srcset="" alt="image-20230418114900816"></h3><h3 id="9-4-跳过request合法域名校验"><a href="#9-4-跳过request合法域名校验" class="headerlink" title="9.4 跳过request合法域名校验"></a>9.4 跳过request合法域名校验</h3><p>详情—–》本地设置—-》不校验合法域名<br><strong>注意：</strong> 仅在开发和调试阶段使用！</p>
<h3 id="9-5-关于跨域和-Ajax-的说明"><a href="#9-5-关于跨域和-Ajax-的说明" class="headerlink" title="9.5 关于跨域和 Ajax 的说明"></a>9.5 关于跨域和 Ajax 的说明</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418154024891.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418154024891.png" srcset="" alt="image-20230418154024891"></p>
<h2 id="十、页面导航"><a href="#十、页面导航" class="headerlink" title="十、页面导航"></a>十、页面导航</h2><h3 id="10-1-声明式导航"><a href="#10-1-声明式导航" class="headerlink" title="10.1 声明式导航"></a>10.1 声明式导航</h3><h4 id="10-1-1导航到tabBar页面"><a href="#10-1-1导航到tabBar页面" class="headerlink" title="10.1.1导航到tabBar页面"></a>10.1.1导航到tabBar页面</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418210447995.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418210447995.png" srcset="" alt="image-20230418210447995"></p>
<h4 id="10-1-2导航到非tabBar页面"><a href="#10-1-2导航到非tabBar页面" class="headerlink" title="10.1.2导航到非tabBar页面"></a>10.1.2导航到非tabBar页面</h4><p>只需要把open-type改成navigate<br>open-type属性可以省略不写！！！！！！！！！</p>
<h4 id="10-1-3-后退导航"><a href="#10-1-3-后退导航" class="headerlink" title="10.1.3 后退导航"></a>10.1.3 后退导航</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418211737136.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418211737136.png" srcset="" alt="image-20230418211737136"></p>
<p>如果只是返回上一页，则可以省略delta属性。（因为默认值为1）</p>
<h3 id="10-2-编程式导航"><a href="#10-2-编程式导航" class="headerlink" title="10.2 编程式导航"></a>10.2 编程式导航</h3><h4 id="10-2-1导航到-tabBar-页面"><a href="#10-2-1导航到-tabBar-页面" class="headerlink" title="10.2.1导航到  tabBar 页面"></a>10.2.1导航到  tabBar 页面</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418212302403.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418212302403.png" srcset="" alt="image-20230418212302403"></p>
<h4 id="10-2-2导航到非-tabBar-页面"><a href="#10-2-2导航到非-tabBar-页面" class="headerlink" title="10.2.2导航到非 tabBar 页面"></a>10.2.2导航到非 tabBar 页面</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418212723513.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418212723513.png" srcset="" alt="image-20230418212723513"></p>
<h4 id="10-2-3后退导航"><a href="#10-2-3后退导航" class="headerlink" title="10.2.3后退导航"></a>10.2.3后退导航</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418212811723.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418212811723.png" srcset="" alt="image-20230418212811723"></p>
<p>如果后退为1： wx.navigateBack()</p>
<h2 id="十一、导航传参"><a href="#十一、导航传参" class="headerlink" title="十一、导航传参"></a>十一、导航传参</h2><h3 id="11-1声明式导航传参"><a href="#11-1声明式导航传参" class="headerlink" title="11.1声明式导航传参"></a>11.1声明式导航传参</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418213434620.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418213434620.png" srcset="" alt="image-20230418213434620"></p>
<h3 id="11-2编程式导航传参"><a href="#11-2编程式导航传参" class="headerlink" title="11.2编程式导航传参"></a>11.2编程式导航传参</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418213651061.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418213651061.png" srcset="" alt="image-20230418213651061"></p>
<h3 id="11-3在-onLoad-中接收导航参数"><a href="#11-3在-onLoad-中接收导航参数" class="headerlink" title="11.3在 onLoad 中接收导航参数"></a>11.3在 onLoad 中接收导航参数</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418213759738.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418213759738.png" srcset="" alt="image-20230418213759738"></p>
<h2 id="十二、下拉刷新-onPullDownRefresh"><a href="#十二、下拉刷新-onPullDownRefresh" class="headerlink" title="十二、下拉刷新 onPullDownRefresh"></a>十二、下拉刷新 onPullDownRefresh</h2><p><img src="https://w.wqdream.vip/lifeIMG/image-20230418225934059.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230418225934059.png" srcset="" alt="image-20230418225934059"></p>
<h3 id="12-1停止下拉效果"><a href="#12-1停止下拉效果" class="headerlink" title="12.1停止下拉效果"></a>12.1停止下拉效果</h3><p>手机里面下拉后需要结束<br>需要用到wx.stopPullDownRefresh()</p>
<h2 id="十三、上拉触底"><a href="#十三、上拉触底" class="headerlink" title="十三、上拉触底"></a>十三、上拉触底</h2><p><img src="https://w.wqdream.vip/lifeIMG/image-20230419120418250.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230419120418250.png" srcset="" alt="image-20230419120418250"></p>
<p><strong>配置上拉触底的距离</strong></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230419120949313.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230419120949313.png" srcset="" alt="image-20230419120949313"></p>
<h2 id="十四、自定义编译模式"><a href="#十四、自定义编译模式" class="headerlink" title="十四、自定义编译模式"></a>十四、自定义编译模式</h2><p>用于在写页面时，进行调试，无需切来切去</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230420002024169.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230420002024169.png" srcset="" alt="image-20230420002024169"></p>
<h2 id="十五、生命周期"><a href="#十五、生命周期" class="headerlink" title="十五、生命周期"></a>十五、生命周期</h2><h3 id="15-1-应用什么周期函数"><a href="#15-1-应用什么周期函数" class="headerlink" title="15.1 应用什么周期函数"></a>15.1 应用什么周期函数</h3><p>在全局的app.js 中定义</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230422135531546.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422135531546.png" srcset="" alt="image-20230422135531546"></p>
<h3 id="15-2-页面的生命周期函数"><a href="#15-2-页面的生命周期函数" class="headerlink" title="15.2 页面的生命周期函数"></a>15.2 页面的生命周期函数</h3><p>常用的两个生命周期为 <code>onLoad</code>  和  <code>onReady</code><br>onLoad： 刚加载页面<br>onReady： 页面第一次完成渲染（可以在里面修改页面布局以及元素，例如：wx.setNavigationBarTitle()   来修改标题）</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230422140146234.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422140146234.png" srcset="" alt="image-20230422140146234"></p>
<h2 id="十六、wxs"><a href="#十六、wxs" class="headerlink" title="十六、wxs"></a>十六、wxs</h2><h3 id="16-1-wxs的应用场景"><a href="#16-1-wxs的应用场景" class="headerlink" title="16.1 wxs的应用场景"></a>16.1 wxs的应用场景</h3><p>不能作为组件的回调函数<br>在wxs中不能调用 js 的函数， 也不能 调用小程序自带的 api</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230422140833560.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422140833560.png" srcset="" alt="image-20230422140833560"></p>
<h3 id="16-2-wxs与-js-的区别"><a href="#16-2-wxs与-js-的区别" class="headerlink" title="16.2 wxs与 js 的区别"></a>16.2 wxs与 js 的区别</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230422141330950.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422141330950.png" srcset="" alt="image-20230422141330950"></p>
<h3 id="16-3-内嵌-wxs-脚本"><a href="#16-3-内嵌-wxs-脚本" class="headerlink" title="16.3 内嵌 wxs 脚本"></a>16.3 内嵌 wxs 脚本</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230422141507727.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422141507727.png" srcset="" alt="image-20230422141507727"></p>
<h3 id="16-4-定义外联的-wxs-脚本"><a href="#16-4-定义外联的-wxs-脚本" class="headerlink" title="16.4 定义外联的 wxs 脚本"></a>16.4 定义外联的 wxs 脚本</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230422142224814.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422142224814.png" srcset="" alt="image-20230422142224814"></p>
<h3 id="16-5-使用外联的-wxs-脚本"><a href="#16-5-使用外联的-wxs-脚本" class="headerlink" title="16.5 使用外联的 wxs 脚本"></a>16.5 使用外联的 wxs 脚本</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230422142807543.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230422142807543.png" srcset="" alt="image-20230422142807543"></p>
<h2 id="十七、自定义组件"><a href="#十七、自定义组件" class="headerlink" title="十七、自定义组件"></a>十七、自定义组件</h2><h3 id="17-1-如何创建组件"><a href="#17-1-如何创建组件" class="headerlink" title="17.1 如何创建组件"></a>17.1 如何创建组件</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230423141628279.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423141628279.png" srcset="" alt="image-20230423141628279"></p>
<h3 id="17-2如何使用组件"><a href="#17-2如何使用组件" class="headerlink" title="17.2如何使用组件"></a>17.2如何使用组件</h3><h4 id="17-2-1-局部引用"><a href="#17-2-1-局部引用" class="headerlink" title="17.2.1 局部引用"></a>17.2.1 局部引用</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230423142825557.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423142825557.png" srcset="" alt="image-20230423142825557"></p>
<h4 id="17-2-2-全局引用"><a href="#17-2-2-全局引用" class="headerlink" title="17.2.2 全局引用"></a>17.2.2 全局引用</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230423143627108.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423143627108.png" srcset="" alt="image-20230423143627108"></p>
<h3 id="17-3-组件和页面的区别"><a href="#17-3-组件和页面的区别" class="headerlink" title="17.3 组件和页面的区别"></a>17.3 组件和页面的区别</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230423144025285.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423144025285.png" srcset="" alt="image-20230423144025285"></p>
<h3 id="17-4-自定义组件的样式"><a href="#17-4-自定义组件的样式" class="headerlink" title="17.4 自定义组件的样式"></a>17.4 自定义组件的样式</h3><p>注意点： app.wxss 中的全局样式对组件无效<br>                只有 class 选择器会有样式隔离效果，id 选择器。属性选择器、标签选择器不受样式隔离的影响</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230423225228936.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423225228936.png" srcset="" alt="image-20230423225228936"></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230423225243236.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423225243236.png" srcset="" alt="image-20230423225243236"></p>
<h3 id="17-5-properties-属性"><a href="#17-5-properties-属性" class="headerlink" title="17.5 properties 属性"></a>17.5 properties 属性</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230423232129844.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423232129844.png" srcset="" alt="image-20230423232129844"></p>
<p>调用时： this.properties.max</p>
<h3 id="17-6数据监听器"><a href="#17-6数据监听器" class="headerlink" title="17.6数据监听器"></a>17.6数据监听器</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230423233054955.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423233054955.png" srcset="" alt="image-20230423233054955"></p>
<p>监听对象属性变化—————————————————————————</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230423234213396.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230423234213396.png" srcset="" alt="image-20230423234213396"></p>
<p>如果需要监听一个对象中的所有属性，可以用 ** 来代替。  例：  rgb.**<br>获得的是一个对象，也就是这个对象修改后的新值</p>
<h3 id="17-7-纯数据字段"><a href="#17-7-纯数据字段" class="headerlink" title="17.7 纯数据字段"></a>17.7 纯数据字段</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230426193008410.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230426193008410.png" srcset="" alt="image-20230426193008410"></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230426193110121.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230426193110121.png" srcset="" alt="image-20230426193110121"></p>
<h3 id="17-8-组件的生命周期函数"><a href="#17-8-组件的生命周期函数" class="headerlink" title="17.8 组件的生命周期函数"></a>17.8 组件的生命周期函数</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230426194628313.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230426194628313.png" srcset="" alt="image-20230426194628313"></p>
<p>主要的生命周期函数：</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230426200247611.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230426200247611.png" srcset="" alt="image-20230426200247611"></p>
<h4 id="17-8-1-lifetimes-节点"><a href="#17-8-1-lifetimes-节点" class="headerlink" title="17.8.1 lifetimes 节点"></a>17.8.1 lifetimes 节点</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230427151058309.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427151058309.png" srcset="" alt="image-20230427151058309"></p>
<h3 id="17-9-组件所在页面的生命周期"><a href="#17-9-组件所在页面的生命周期" class="headerlink" title="17.9 组件所在页面的生命周期"></a>17.9 组件所在页面的生命周期</h3><p>页面引入组件后，组件需要根据这个页面做出相应的处理，就需要用到组件所在页面的生命周期函数</p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230427151542864.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427151542864.png" srcset="" alt="image-20230427151542864"></p>
<h3 id="17-10-自定义组件—插槽"><a href="#17-10-自定义组件—插槽" class="headerlink" title="17.10 自定义组件—插槽"></a>17.10 自定义组件—插槽</h3><h4 id="17-10-1-单个插槽"><a href="#17-10-1-单个插槽" class="headerlink" title="17.10.1 单个插槽"></a>17.10.1 单个插槽</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230427152029506.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427152029506.png" srcset="" alt="image-20230427152029506"></p>
<h4 id="17-10-2-启用多个插槽"><a href="#17-10-2-启用多个插槽" class="headerlink" title="17.10.2 启用多个插槽"></a>17.10.2 启用多个插槽</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230427152401148.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427152401148.png" srcset="" alt="image-20230427152401148"></p>
<h4 id="17-10-3-定义多个插槽"><a href="#17-10-3-定义多个插槽" class="headerlink" title="17.10.3 定义多个插槽"></a>17.10.3 定义多个插槽</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230427152556921.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427152556921.png" srcset="" alt="image-20230427152556921"></p>
<h4 id="17-10-4-使用多个插槽"><a href="#17-10-4-使用多个插槽" class="headerlink" title="17.10.4 使用多个插槽"></a>17.10.4 使用多个插槽</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230427152705081.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427152705081.png" srcset="" alt="image-20230427152705081"></p>
<h3 id="17-11-父子组件之间通信"><a href="#17-11-父子组件之间通信" class="headerlink" title="17.11 父子组件之间通信"></a>17.11 父子组件之间通信</h3><h4 id="17-11-1-属性绑定"><a href="#17-11-1-属性绑定" class="headerlink" title="17.11.1 属性绑定"></a>17.11.1 属性绑定</h4><ul>
<li>父组件</li>
</ul>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230427215451360.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427215451360.png" srcset="" alt="image-20230427215451360"></p>
<ul>
<li>子组件</li>
</ul>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230427215514733.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230427215514733.png" srcset="" alt="image-20230427215514733"></p>
<h4 id="17-11-2-事件绑定"><a href="#17-11-2-事件绑定" class="headerlink" title="17.11.2 事件绑定"></a>17.11.2 事件绑定</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429123403364.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429123403364.png" srcset="" alt="image-20230429123403364"></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230429123440464.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429123440464.png" srcset="" alt="image-20230429123440464"></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230429123532792.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429123532792.png" srcset="" alt="image-20230429123532792"></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230429123639519.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429123639519.png" srcset="" alt="image-20230429123639519"></p>
<h4 id="17-11-3-获取组件实例"><a href="#17-11-3-获取组件实例" class="headerlink" title="17.11.3 获取组件实例"></a>17.11.3 获取组件实例</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429124137910.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429124137910.png" srcset="" alt="image-20230429124137910"></p>
<h3 id="17-12-自定义组件——-behaviors"><a href="#17-12-自定义组件——-behaviors" class="headerlink" title="17.12 自定义组件——-behaviors"></a>17.12 自定义组件——-behaviors</h3><h4 id="17-12-1-什么是-behaviors"><a href="#17-12-1-什么是-behaviors" class="headerlink" title="17.12.1 什么是 behaviors"></a>17.12.1 什么是 behaviors</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429125144433.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429125144433.png" srcset="" alt="image-20230429125144433"></p>
<h4 id="17-12-2-behaviors的工作方式"><a href="#17-12-2-behaviors的工作方式" class="headerlink" title="17.12.2 behaviors的工作方式"></a>17.12.2 behaviors的工作方式</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429125319078.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429125319078.png" srcset="" alt="image-20230429125319078"></p>
<h4 id="17-12-3-创建-behaviors"><a href="#17-12-3-创建-behaviors" class="headerlink" title="17.12.3 创建 behaviors"></a>17.12.3 创建 behaviors</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429125541935.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429125541935.png" srcset="" alt="image-20230429125541935"></p>
<h4 id="17-12-4-导入并使用-behaviors"><a href="#17-12-4-导入并使用-behaviors" class="headerlink" title="17.12.4 导入并使用 behaviors"></a>17.12.4 导入并使用 behaviors</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429130024902.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429130024902.png" srcset="" alt="image-20230429130024902"></p>
<p>ps: 可以直接在 wxml 页面使用导入的 属性</p>
<h4 id="17-12-5-behaviors-中的可用字段"><a href="#17-12-5-behaviors-中的可用字段" class="headerlink" title="17.12.5 behaviors 中的可用字段"></a>17.12.5 behaviors 中的可用字段</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429132618797.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429132618797.png" srcset="" alt="image-20230429132618797"></p>
<h2 id="十八、npm-包"><a href="#十八、npm-包" class="headerlink" title="十八、npm 包"></a>十八、npm 包</h2><h3 id="18-1小程序对-npm-的支持与限制"><a href="#18-1小程序对-npm-的支持与限制" class="headerlink" title="18.1小程序对 npm 的支持与限制"></a>18.1小程序对 npm 的支持与限制</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429133748334.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429133748334.png" srcset="" alt="image-20230429133748334"></p>
<h3 id="18-2-安装weapp-组件"><a href="#18-2-安装weapp-组件" class="headerlink" title="18.2 安装weapp 组件"></a>18.2 安装weapp 组件</h3><p><a target="_blank" rel="noopener" href="https://youzan.github.io/vant-weapp/#/quickstart">https://youzan.github.io/vant-weapp/#/quickstart</a></p>
<p><img src="https://w.wqdream.vip/lifeIMG/image-20230429140209996.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429140209996.png" srcset="" alt="image-20230429140209996"></p>
<h3 id="18-3-使用-vant-组件"><a href="#18-3-使用-vant-组件" class="headerlink" title="18.3 使用 vant 组件"></a>18.3 使用 vant 组件</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230429142307495.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230429142307495.png" srcset="" alt="image-20230429142307495"></p>
<h2 id="十九、自定义样式"><a href="#十九、自定义样式" class="headerlink" title="十九、自定义样式"></a>十九、自定义样式</h2><p>在wxss样式中，在根节点上定义css变量</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">// 定义css变量需要使用 -- 开头</span><br><span class="line"><span class="selector-tag">html</span>:&#123;</span><br><span class="line">    <span class="attr">--bgc_color</span>: <span class="number">#ccc</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>使用css 变量</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">// 使用 <span class="selector-tag">var</span> 来引入变量</span><br><span class="line"><span class="selector-class">.content</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">var</span>(--bgc_color)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="19-1、定制全局主题样式-vant的主题样式"><a href="#19-1、定制全局主题样式-vant的主题样式" class="headerlink" title="19.1、定制全局主题样式(vant的主题样式)"></a>19.1、定制全局主题样式(vant的主题样式)</h3><p>先在 app.wxss (全局样式中)的page节点中，声明需要定制的css样式</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* app.wxss*/</span></span><br><span class="line">page&#123;</span><br><span class="line">    <span class="comment">/* 定制颜色 */</span></span><br><span class="line">    <span class="attr">--button-danger-background-color</span>: <span class="number">#c00000</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>注意： </p>
<ul>
<li>用 page 节点是因为，小程序全局节点是 page</li>
<li><a target="_blank" rel="noopener" href="https://github.com/youzan/vant-weapp/blob/dev/packages/common/style/var.less%EF%BC%88%E5%90%8D%E5%AD%97%E6%98%AF%E5%9C%A8%E8%BF%99%E9%87%8C%E9%9D%A2%E6%89%BE%E7%9A%84%EF%BC%89">https://github.com/youzan/vant-weapp/blob/dev/packages/common/style/var.less（名字是在这里面找的）</a></li>
</ul>
<h2 id="二十、API-promise-化"><a href="#二十、API-promise-化" class="headerlink" title="二十、API promise 化"></a>二十、API promise 化</h2><p><img src="https://w.wqdream.vip/lifeIMG/image-20230501210858374.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230501210858374.png" srcset="" alt="image-20230501210858374"></p>
<p>每次安装完包后都要删除 miniprogram_npm 文件夹，重新构建 npm</p>
<ul>
<li>实现</li>
</ul>
<p>在app.js 中引入下载好的包</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* 引入promisifyAll */</span></span><br><span class="line"><span class="keyword">import</span> &#123; promisifyAll &#125; <span class="keyword">from</span> <span class="string">&#x27;miniprogram-api-promise&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/* 声明一个 wxp 把他和 wx.p 绑定到一个 空对象上 （同一个实例上）*/</span></span><br><span class="line"><span class="keyword">const</span> wxp = wx.<span class="property">p</span> = &#123;&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* 把 wx 和 wxp 传入 promisifyAll 中，之后直接掉 wx.p 就可以了*/</span></span><br><span class="line"><span class="title function_">promisifyAll</span>(wx, wxp)</span><br></pre></td></tr></table></figure>

<h3 id="20-1-调用-promise-化后的-API"><a href="#20-1-调用-promise-化后的-API" class="headerlink" title="20.1 调用 promise 化后的 API"></a>20.1 调用 promise 化后的 API</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230501223436179.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230501223436179.png" srcset="" alt="image-20230501223436179"></p>
<h2 id="二十一、全局数据共享"><a href="#二十一、全局数据共享" class="headerlink" title="二十一、全局数据共享"></a>二十一、全局数据共享</h2><h3 id="21-1小程序中的全局共享方案"><a href="#21-1小程序中的全局共享方案" class="headerlink" title="21.1小程序中的全局共享方案"></a>21.1小程序中的全局共享方案</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230501230628461.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230501230628461.png" srcset="" alt="image-20230501230628461"></p>
<h3 id="21-2-安装-MobX-包"><a href="#21-2-安装-MobX-包" class="headerlink" title="21.2 安装 MobX 包"></a>21.2 安装 MobX 包</h3><figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"># 安装完后，删除 miniprogram_npm 目录后，重新构建 npm</span><br><span class="line">npm install --save mobx-miniprogram@<span class="number">4</span>.<span class="number">13</span>.<span class="number">2</span> mobx-miniprogram-bindings@<span class="number">1</span>.<span class="number">2</span>.<span class="number">1</span></span><br></pre></td></tr></table></figure>

<h3 id="21-3-创建-MobX-的-Store-实例"><a href="#21-3-创建-MobX-的-Store-实例" class="headerlink" title="21.3 创建 MobX 的 Store 实例"></a>21.3 创建 MobX 的 Store 实例</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230507221811607.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230507221811607.png" srcset="" alt="image-20230507221811607"></p>
<h3 id="21-4、将-stort-中的成员绑定到页面中"><a href="#21-4、将-stort-中的成员绑定到页面中" class="headerlink" title="21.4、将 stort 中的成员绑定到页面中"></a>21.4、将 stort 中的成员绑定到页面中</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230507222810703.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230507222810703.png" srcset="" alt="image-20230507222810703"></p>
<h3 id="21-5、在页面上使用-store-成员"><a href="#21-5、在页面上使用-store-成员" class="headerlink" title="21.5、在页面上使用 store 成员"></a>21.5、在页面上使用 store 成员</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230512101942007.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230512101942007.png" srcset="" alt="image-20230512101942007"></p>
<h3 id="21-6、将组件中的成员绑定到组件中"><a href="#21-6、将组件中的成员绑定到组件中" class="headerlink" title="21.6、将组件中的成员绑定到组件中"></a>21.6、将组件中的成员绑定到组件中</h3><p><img src="https://w.wqdream.vip/lifeIMG/image-20230512102305922.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230512102305922.png" srcset="" alt="image-20230512102305922"></p>
<p>ps：页面上的使用方法，同 21.5 一模一样</p>
<h2 id="二十二、-分包"><a href="#二十二、-分包" class="headerlink" title="二十二、 分包"></a>二十二、 分包</h2><h3 id="22-1-分包后的项目构成"><a href="#22-1-分包后的项目构成" class="headerlink" title="22.1 分包后的项目构成"></a>22.1 分包后的项目构成</h3><p><img src="https://w.wqdream.vip/lifeIMG/%E5%88%86%E5%8C%85.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/%E5%88%86%E5%8C%85.png" srcset="" alt="分包"></p>
<h3 id="22-2、分包的加载规则"><a href="#22-2、分包的加载规则" class="headerlink" title="22.2、分包的加载规则"></a>22.2、分包的加载规则</h3><ol>
<li>在小程序启动的时候，默认会下载主包并启动主包内页面<ul>
<li>所以 tabBar 页面需要放在主包中</li>
</ul>
</li>
<li>当用户进入分包内某个页面时，客户端会把对应的分包下载下来，下载完成后再进行展示<ul>
<li>非 tabBar页面可以按照功能的不同，划分为不同的分包之后，进行按需下载</li>
</ul>
</li>
</ol>
<h3 id="22-3、分包的体积限制"><a href="#22-3、分包的体积限制" class="headerlink" title="22.3、分包的体积限制"></a>22.3、分包的体积限制</h3><p>目前，小程序分包的大小有以下两个限制：</p>
<ul>
<li>整个小程序所有的分包大小不超过 16M （分包 + 所有分包）</li>
<li>单个分包&#x2F;主包大小不能超过 2M</li>
</ul>
<h3 id="22-4、使用分包"><a href="#22-4、使用分包" class="headerlink" title="22.4、使用分包"></a>22.4、使用分包</h3><h4 id="22-4-1、配置方法"><a href="#22-4-1、配置方法" class="headerlink" title="22.4.1、配置方法"></a>22.4.1、配置方法</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230512201441255.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230512201441255.png" srcset="" alt="image-20230512201441255"></p>
<p>ps：subPackages数组中，一个对象就是一个分包</p>
<p>可以和root平齐，写一个name的属性（这就是分包的别名）</p>
<h4 id="22-4-2-打包的原则"><a href="#22-4-2-打包的原则" class="headerlink" title="22.4.2 打包的原则"></a>22.4.2 打包的原则</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230517123930523.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230517123930523.png" srcset="" alt="image-20230517123930523"></p>
<h4 id="22-4-3-引用原则"><a href="#22-4-3-引用原则" class="headerlink" title="22.4.3 引用原则"></a>22.4.3 引用原则</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230517124027070.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230517124027070.png" srcset="" alt="image-20230517124027070"></p>
<h3 id="22-5-独立分包"><a href="#22-5-独立分包" class="headerlink" title="22.5 独立分包"></a>22.5 独立分包</h3><p><strong>Q：为什么要有独立分包？</strong><br><strong>A</strong>：一个小程序，想要启动，必须先启动主包，然后再跳转到别的包。<em>但是也有时候用户不想打开主包，而直接想用分包启动页面，这时候就用到了独立分包</em></p>
<p><strong>Q：独立分包和普通分包的区别？</strong><br><strong>A：</strong> 1. 普通分包必须依赖于主包才能运行。 2. 独立分包可以在不下载主包的情况下，独立运行</p>
<p><strong>Q：独立分包的应用场景？</strong><br><strong>A：</strong> 当不需要主包即可运行时，可以采用独立分包，可大大提升分包页面的启动速度</p>
<p>ps： 一个小程序可以有多个独立分包</p>
<h4 id="22-5-1-独立分包的配置方法"><a href="#22-5-1-独立分包的配置方法" class="headerlink" title="22.5.1 独立分包的配置方法"></a>22.5.1 独立分包的配置方法</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230517125119702.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230517125119702.png" srcset="" alt="image-20230517125119702"></p>
<p>ps：也就是在普通分包的配置项中加入 “independent”: true</p>
<h4 id="22-5-2-引用原则"><a href="#22-5-2-引用原则" class="headerlink" title="22.5.2 引用原则"></a>22.5.2 引用原则</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230517125758607.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230517125758607.png" srcset="" alt="image-20230517125758607"></p>
<h3 id="22-6、分包预下载"><a href="#22-6、分包预下载" class="headerlink" title="22.6、分包预下载"></a>22.6、分包预下载</h3><p>当我们启动某个页面时，框架会自动帮我们下载好需要用到的分包，提高用户体验</p>
<h4 id="22-6-1配置分包预下载"><a href="#22-6-1配置分包预下载" class="headerlink" title="22.6.1配置分包预下载"></a>22.6.1配置分包预下载</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230517130221634.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230517130221634.png" srcset="" alt="image-20230517130221634"></p>
<h4 id="22-6-2-分包预下载的限制"><a href="#22-6-2-分包预下载的限制" class="headerlink" title="22.6.2 分包预下载的限制"></a>22.6.2 分包预下载的限制</h4><p><img src="https://w.wqdream.vip/lifeIMG/image-20230517130828458.png" class="lazyload" data-srcset="https://w.wqdream.vip/lifeIMG/image-20230517130828458.png" srcset="" alt="image-20230517130828458"></p>
<h2 id="二十三、小案例—-自定义tabBar"><a href="#二十三、小案例—-自定义tabBar" class="headerlink" title="二十三、小案例—-自定义tabBar"></a>二十三、小案例—-自定义tabBar</h2><figure class="highlight text"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html</span><br><span class="line">这个文档是小程序官方自定义 tabBar 的官方文档</span><br><span class="line"></span><br><span class="line">ps：跟着文档走，总共有三步</span><br></pre></td></tr></table></figure>

<h3 id="23-1-覆盖-vant-的样式"><a href="#23-1-覆盖-vant-的样式" class="headerlink" title="23.1 覆盖 vant 的样式"></a>23.1 覆盖 vant 的样式</h3><ol>
<li>首先在 tabBar 组件的 Component 中，声明一个option的对象，在里面声明一个 styleIsolation: ‘shared’</li>
<li>其次直接选中vant样式，直接进行修改</li>
</ol>
<h3 id="23-2-组件调用mobx"><a href="#23-2-组件调用mobx" class="headerlink" title="23.2 组件调用mobx"></a>23.2 组件调用mobx</h3><p><a target="_blank" rel="noopener" href="https://github.com/wechat-miniprogram/mobx-miniprogram-bindings">https://github.com/wechat-miniprogram/mobx-miniprogram-bindings</a></p>
<h3 id="23-3-切换tabBar的时候-切换页面"><a href="#23-3-切换tabBar的时候-切换页面" class="headerlink" title="23.3 切换tabBar的时候 切换页面"></a>23.3 切换tabBar的时候 切换页面</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 把index(点击的是第几个按钮) 存到 store中</span></span><br><span class="line"><span class="comment">// 在store页面中</span></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">const</span> store = <span class="title function_">observable</span>(&#123;</span><br><span class="line">    <span class="comment">// 把需要传递的数据直接写在这</span></span><br><span class="line">    <span class="attr">numA</span>: <span class="number">1</span>,</span><br><span class="line">    <span class="attr">numB</span>: <span class="number">1</span>,</span><br><span class="line">    <span class="attr">active</span>:<span class="number">0</span>,</span><br><span class="line">    <span class="comment">// 计算属性-----get意思是只读</span></span><br><span class="line">    <span class="keyword">get</span> <span class="title function_">sum</span>() &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="variable language_">this</span>.<span class="property">numA</span> + <span class="variable language_">this</span>.<span class="property">numB</span></span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="comment">// 用 action 方法，修改 stort 中的数据</span></span><br><span class="line">    <span class="attr">editNum1</span>: <span class="title function_">action</span>(<span class="keyword">function</span>(<span class="params">step</span>) &#123;</span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">numA</span> += step</span><br><span class="line">    &#125;),</span><br><span class="line">    <span class="attr">editNum2</span>: <span class="title function_">action</span>(<span class="keyword">function</span>(<span class="params">step</span>) &#123;</span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">numB</span> += step</span><br><span class="line">    &#125;),</span><br><span class="line">    <span class="attr">editAction</span>: <span class="title function_">action</span>(<span class="keyword">function</span>(<span class="params">val</span>)&#123;</span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">active</span> = val</span><br><span class="line">    &#125;)</span><br><span class="line"></span><br><span class="line">&#125;)</span><br><span class="line">		</span><br><span class="line"></span><br><span class="line"><span class="comment">// 在tabBar组件中。别忘了挂载store属性和对象</span></span><br><span class="line"><span class="title function_">onChange</span>(<span class="params">event</span>) &#123;</span><br><span class="line">            <span class="comment">// event.detail 的值为当前选中项的索引</span></span><br><span class="line">            wx.<span class="title function_">switchTab</span>(&#123;</span><br><span class="line">              <span class="attr">url</span>: <span class="variable language_">this</span>.<span class="property">data</span>.<span class="property">list</span>[event.<span class="property">detail</span>].<span class="property">pagePath</span>,</span><br><span class="line">            &#125;)</span><br><span class="line">            <span class="comment">// store 中创建的更新</span></span><br><span class="line">            <span class="variable language_">this</span>.<span class="title function_">editAction</span>(event.<span class="property">detail</span>)</span><br><span class="line">          &#125;,</span><br></pre></td></tr></table></figure>

<h3 id="23-4-修改tabBar选中文本颜色"><a href="#23-4-修改tabBar选中文本颜色" class="headerlink" title="23.4 修改tabBar选中文本颜色"></a>23.4 修改tabBar选中文本颜色</h3><p>&#x2F;&#x2F;  这个是vant 官网中 tabBar的位置，最下方有修改方法<br><a target="_blank" rel="noopener" href="https://youzan.github.io/vant-weapp/#/tabbar">https://youzan.github.io/vant-weapp/#/tabbar</a></p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">van-tabbar</span> <span class="attr">active-color</span>=<span class="string">&quot;#13A7A0&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">van-tabbar</span>&gt;</span></span><br></pre></td></tr></table></figure>


  </div>
  
  
    
    <div class='footer'>
       <!-- 参考资料、相关资料等 -->
      
       <!-- 相关文章 -->
      
      <!-- 版权声明组件 -->
      
      <!-- 打赏组件 -->
      
    </div>
  
  
    


  <div class='article-meta' id="bottom">
    <div class='new-meta-box'>
      
        
          <div class="new-meta-item date" itemprop="dateModified" datetime="2023-07-07T15:29:28+08:00">
  <a class='notlink'>
    <i class="fa-solid fa-edit fa-fw" aria-hidden="true"></i>
    <p>更新于：2023年7月7日</p>
  </a>
</div>

        
      
        
          
  
  <div class="new-meta-item meta-tags"><a class="tag" href="/tags/%E7%AC%94%E8%AE%B0/" rel="nofollow"><i class="fa-solid fa-hashtag fa-fw" aria-hidden="true"></i><p>笔记</p></a></div> <div class="new-meta-item meta-tags"><a class="tag" href="/tags/%E5%B0%8F%E7%A8%8B%E5%BA%8F/" rel="nofollow"><i class="fa-solid fa-hashtag fa-fw" aria-hidden="true"></i><p>小程序</p></a></div>
  <span hidden itemprop="keywords">笔记 小程序</span>


        
      
        
          
  <div class="new-meta-item share -mob-share-list">
  <div class="-mob-share-list share-body">
    
      
        <a class="-mob-share-qq" title="" rel="external nofollow noopener noreferrer noopener"
          
          target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://wyzqy.gitee.io/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/&title=小程序笔记 - 小新的记事本&summary=原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~"
          
          >
          
            <img src="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/logo/128/qq.png" class="lazyload" data-srcset="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/logo/128/qq.png" srcset="">
          
        </a>
      
    
      
        <a class="-mob-share-qzone" title="" rel="external nofollow noopener noreferrer noopener"
          
          target="_blank" href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https://wyzqy.gitee.io/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/&title=小程序笔记 - 小新的记事本&summary=原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~"
          
          >
          
            <img src="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/logo/128/qzone.png" class="lazyload" data-srcset="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/logo/128/qzone.png" srcset="">
          
        </a>
      
    
      
        <a class="-mob-share-weibo" title="" rel="external nofollow noopener noreferrer noopener"
          
          target="_blank" href="http://service.weibo.com/share/share.php?url=https://wyzqy.gitee.io/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/&title=小程序笔记 - 小新的记事本&summary=原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~"
          
          >
          
            <img src="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/logo/128/weibo.png" class="lazyload" data-srcset="https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/logo/128/weibo.png" srcset="">
          
        </a>
      
    
      
    
      
    
  </div>
</div>



        
      
    </div>
    <!-- Custom Files bottomMeta begin -->
    
    <!-- Custom Files bottomMeta end -->
  </div>


  
  

  
    <div class="prev-next">
      
        <a class='prev' href='/2023/07/25/Form%E8%A1%A8%E5%8D%95%E6%8F%90%E4%BA%A4%E9%97%AE%E9%A2%98/'>
          <p class='title'><i class="fa-solid fa-chevron-left" aria-hidden="true"></i>Form表单提交问题</p>
          <p class='content'>form表单提交问题前言​	有时，在我们的 form 表单中只有一个输入框，我们可能只是把他当做搜索框或者另有他用，不希望在回车时，去发起提交，那我们又该怎么操作呢？


问题分析W3C 标准中...</p>
        </a>
      
      
        <a class='next' href='/2021/12/12/React-%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/'>
          <p class='title'>React 生命周期<i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
          <p class='content'>写在前面说到React生命周期，就如同人的一生，从出生，到成长，再到凉凉，其中经历的就叫做人的生命周期。那么 React 也有自己的生命周期。但React更新速度之快，现在版本和之前形成了  “...</p>
        </a>
      
    </div>
  
  <!-- Custom Files postEnd begin-->
  
  <!-- Custom Files postEnd end-->
</article>


  


  <article class="post white-box shadow floatable blur" id="comments">
    <span hidden>
      <meta itemprop="discussionUrl" content="/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/index.html#comments">
    </span>
    <p ct><i class='fas fa-comments'></i> 评论</p>
    

    <div id="layoutHelper-comments"></div>

  </article>






</div>
<aside id='l_side' itemscope itemtype="http://schema.org/WPSideBar">
  

  
    
    
      
    
  


<div class="widget-sticky pjax">

  
  


  <section class="widget toc-wrapper desktop mobile " id="toc-div" >
    
  <header>
    
      <i class="fa-solid fa-list fa-fw" aria-hidden="true"></i><span class='name'>本文目录</span>
    
  </header>


    <div class='content'>
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%80%E3%80%81%E8%B4%A6%E5%8F%B7%E7%9A%84%E6%B3%A8%E5%86%8C%E4%B8%8E%E5%B7%A5%E5%85%B7%E4%B8%8B%E8%BD%BD"><span class="toc-text">一、账号的注册与工具下载</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C%E3%80%81%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84"><span class="toc-text">二、项目结构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1%E3%80%81%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%A1%B5%E9%9D%A2%E7%9A%84%E7%BB%84%E6%88%90%E9%83%A8%E5%88%86"><span class="toc-text">2.1、小程序页面的组成部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2%E3%80%81JSON%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-text">2.2、JSON配置文件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-1%E3%80%81app-json-%E6%96%87%E4%BB%B6"><span class="toc-text">2.2.1、app.json 文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-2%E3%80%81project-config-json%E6%96%87%E4%BB%B6"><span class="toc-text">2.2.2、project.config.json文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-3%E3%80%81sitemap-json-%E6%96%87%E4%BB%B6"><span class="toc-text">2.2.3、sitemap.json 文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-4%E3%80%81%E9%A1%B5%E9%9D%A2%E7%9A%84-json-%E6%96%87%E4%BB%B6"><span class="toc-text">2.2.4、页面的 .json 文件</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%89%E3%80%81%E9%A1%B5%E9%9D%A2%E7%9B%B8%E5%85%B3"><span class="toc-text">三、页面相关</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#3-1%E3%80%81%E6%96%B0%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%A1%B5%E9%9D%A2"><span class="toc-text">3.1、新建一个小程序页面</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2%E3%80%81-%E4%BF%AE%E6%94%B9%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%A6%96%E9%A1%B5"><span class="toc-text">3.2、 修改小程序首页</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-3%E3%80%81WXML-%E5%92%8C-HTML-%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-text">3.3、WXML 和 HTML 的区别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-4%E3%80%81WXSS%E5%92%8CCSS%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-text">3.4、WXSS和CSS的区别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-5%E3%80%81%E5%B0%8F%E7%A8%8B%E5%BA%8F%E4%B8%AD-JS-%E6%96%87%E4%BB%B6%E7%9A%84%E5%88%86%E7%B1%BB"><span class="toc-text">3.5、小程序中 .JS 文件的分类</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9B%9B%E3%80%81%E7%BB%84%E4%BB%B6"><span class="toc-text">四、组件</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1%E3%80%81%E5%B8%B8%E7%94%A8%E7%9A%84%E8%A7%86%E5%9B%BE%E7%BB%84%E4%BB%B6"><span class="toc-text">4.1、常用的视图组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-2%E3%80%81swiper%E5%B8%B8%E7%94%A8%E5%B1%9E%E6%80%A7"><span class="toc-text">4.2、swiper常用属性</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-3-text%E5%92%8Crich-text"><span class="toc-text">4.3 text和rich-text</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-4-button%E7%BB%84%E4%BB%B6"><span class="toc-text">4.4 button组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-5%E3%80%81image%E7%BB%84%E4%BB%B6"><span class="toc-text">4.5、image组件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#4-5-1%E3%80%81image%E7%BB%84%E4%BB%B6%E7%9A%84-mode-%E5%B1%9E%E6%80%A7"><span class="toc-text">4.5.1、image组件的 mode 属性</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-6%E3%80%81navigator%E7%BB%84%E4%BB%B6"><span class="toc-text">4.6、navigator组件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%94%E3%80%81API"><span class="toc-text">五、API</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%AD%E3%80%81%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A%E4%BB%A5%E5%8F%8A%E6%B8%B2%E6%9F%93"><span class="toc-text">六、数据绑定以及渲染</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#6-1%E3%80%81%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A"><span class="toc-text">6.1、数据绑定</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2%E3%80%81-%E4%BA%8B%E4%BB%B6%E7%BB%91%E5%AE%9A"><span class="toc-text">6.2、 事件绑定</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#6-2-1-%E5%B8%B8%E7%94%A8%E7%9A%84%E4%BA%8B%E4%BB%B6"><span class="toc-text">6.2.1 常用的事件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-2-2-%E3%80%81event%E4%BA%8B%E4%BB%B6"><span class="toc-text">6.2.2 、event事件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-2-3%E3%80%81%E4%B8%BAdata%E4%B8%AD%E7%9A%84-%E5%B1%9E%E6%80%A7%E8%B5%8B%E5%80%BC"><span class="toc-text">6.2.3、为data中的 属性赋值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-2-4%E3%80%81%E4%BA%8B%E4%BB%B6%E4%BC%A0%E5%8F%82"><span class="toc-text">6.2.4、事件传参</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-2-5%E3%80%81bindinput"><span class="toc-text">6.2.5、bindinput</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-3%E3%80%81%E6%9D%A1%E4%BB%B6%E6%B8%B2%E6%9F%93"><span class="toc-text">6.3、条件渲染</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#6-3-1wx-if"><span class="toc-text">6.3.1wx:if</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-3-2%E3%80%81hidden"><span class="toc-text">6.3.2、hidden</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-4%E3%80%81%E5%BE%AA%E7%8E%AF%EF%BC%88wx-for%EF%BC%89"><span class="toc-text">6.4、循环（wx:for）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%83%E3%80%81WXSS"><span class="toc-text">七、WXSS</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#7-1-rpx"><span class="toc-text">7.1 rpx</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-2-%E6%A0%B7%E5%BC%8F%E5%AF%BC%E5%85%A5"><span class="toc-text">7.2 样式导入</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%AB%E3%80%81%E5%85%A8%E5%B1%80%E9%85%8D%E7%BD%AE%EF%BC%88app-json%EF%BC%89"><span class="toc-text">八、全局配置（app.json）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#8-1-Window%E8%8A%82%E7%82%B9"><span class="toc-text">8.1.Window节点</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-2Window%E8%8A%82%E7%82%B9%E5%B8%B8%E7%94%A8%E9%85%8D%E7%BD%AE%E9%A1%B9"><span class="toc-text">8.2Window节点常用配置项</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-3%E4%B8%8B%E6%8B%89%E5%88%B7%E6%96%B0"><span class="toc-text">8.3下拉刷新</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-3-tabBar"><span class="toc-text">8.3 tabBar</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#8-3-1-tabBar%E7%9A%84%E7%BB%84%E6%88%90%E9%83%A8%E5%88%86"><span class="toc-text">8.3.1 tabBar的组成部分</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#8-3-2-tabBar%E8%8A%82%E7%82%B9%E7%9A%84%E9%85%8D%E7%BD%AE%E9%A1%B9"><span class="toc-text">8.3.2 tabBar节点的配置项</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#8-3-3-%E6%AF%8F%E4%B8%AAtab%E9%A1%B5%E7%AD%BE%E4%B8%AD%EF%BC%88list%E6%95%B0%E7%BB%84%E4%B8%AD%E5%AD%98%E5%9C%A8%E7%9A%84%EF%BC%89"><span class="toc-text">8.3.3 每个tab页签中（list数组中存在的）</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B9%9D%E3%80%81%E7%BD%91%E7%BB%9C%E6%95%B0%E6%8D%AE%E8%AF%B7%E6%B1%82"><span class="toc-text">九、网络数据请求</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#9-1-%E9%85%8D%E7%BD%AE-request-%E5%90%88%E6%B3%95%E5%9F%9F%E5%90%8D"><span class="toc-text">9.1 配置 request 合法域名</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-2-%E5%8F%91%E9%80%81GET%E8%AF%B7%E6%B1%82%E5%92%8CPOST%E8%AF%B7%E6%B1%82%EF%BC%88%E5%8C%BA%E5%88%AB%E5%B0%B1%E5%9C%A8%E4%BA%8Emethod%E4%B8%AD%EF%BC%89"><span class="toc-text">9.2 发送GET请求和POST请求（区别就在于method中）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-3-%E9%A1%B5%E9%9D%A2%E4%B8%80%E5%8A%A0%E8%BD%BD%E5%B0%B1%E8%AF%B7%E6%B1%82%E6%95%B0%E6%8D%AE"><span class="toc-text">9.3 页面一加载就请求数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link"><span class="toc-text"></span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-4-%E8%B7%B3%E8%BF%87request%E5%90%88%E6%B3%95%E5%9F%9F%E5%90%8D%E6%A0%A1%E9%AA%8C"><span class="toc-text">9.4 跳过request合法域名校验</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-5-%E5%85%B3%E4%BA%8E%E8%B7%A8%E5%9F%9F%E5%92%8C-Ajax-%E7%9A%84%E8%AF%B4%E6%98%8E"><span class="toc-text">9.5 关于跨域和 Ajax 的说明</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E3%80%81%E9%A1%B5%E9%9D%A2%E5%AF%BC%E8%88%AA"><span class="toc-text">十、页面导航</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#10-1-%E5%A3%B0%E6%98%8E%E5%BC%8F%E5%AF%BC%E8%88%AA"><span class="toc-text">10.1 声明式导航</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#10-1-1%E5%AF%BC%E8%88%AA%E5%88%B0tabBar%E9%A1%B5%E9%9D%A2"><span class="toc-text">10.1.1导航到tabBar页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#10-1-2%E5%AF%BC%E8%88%AA%E5%88%B0%E9%9D%9EtabBar%E9%A1%B5%E9%9D%A2"><span class="toc-text">10.1.2导航到非tabBar页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#10-1-3-%E5%90%8E%E9%80%80%E5%AF%BC%E8%88%AA"><span class="toc-text">10.1.3 后退导航</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10-2-%E7%BC%96%E7%A8%8B%E5%BC%8F%E5%AF%BC%E8%88%AA"><span class="toc-text">10.2 编程式导航</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#10-2-1%E5%AF%BC%E8%88%AA%E5%88%B0-tabBar-%E9%A1%B5%E9%9D%A2"><span class="toc-text">10.2.1导航到  tabBar 页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#10-2-2%E5%AF%BC%E8%88%AA%E5%88%B0%E9%9D%9E-tabBar-%E9%A1%B5%E9%9D%A2"><span class="toc-text">10.2.2导航到非 tabBar 页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#10-2-3%E5%90%8E%E9%80%80%E5%AF%BC%E8%88%AA"><span class="toc-text">10.2.3后退导航</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%B8%80%E3%80%81%E5%AF%BC%E8%88%AA%E4%BC%A0%E5%8F%82"><span class="toc-text">十一、导航传参</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#11-1%E5%A3%B0%E6%98%8E%E5%BC%8F%E5%AF%BC%E8%88%AA%E4%BC%A0%E5%8F%82"><span class="toc-text">11.1声明式导航传参</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-2%E7%BC%96%E7%A8%8B%E5%BC%8F%E5%AF%BC%E8%88%AA%E4%BC%A0%E5%8F%82"><span class="toc-text">11.2编程式导航传参</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-3%E5%9C%A8-onLoad-%E4%B8%AD%E6%8E%A5%E6%94%B6%E5%AF%BC%E8%88%AA%E5%8F%82%E6%95%B0"><span class="toc-text">11.3在 onLoad 中接收导航参数</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%BA%8C%E3%80%81%E4%B8%8B%E6%8B%89%E5%88%B7%E6%96%B0-onPullDownRefresh"><span class="toc-text">十二、下拉刷新 onPullDownRefresh</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#12-1%E5%81%9C%E6%AD%A2%E4%B8%8B%E6%8B%89%E6%95%88%E6%9E%9C"><span class="toc-text">12.1停止下拉效果</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%B8%89%E3%80%81%E4%B8%8A%E6%8B%89%E8%A7%A6%E5%BA%95"><span class="toc-text">十三、上拉触底</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E5%9B%9B%E3%80%81%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BC%96%E8%AF%91%E6%A8%A1%E5%BC%8F"><span class="toc-text">十四、自定义编译模式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%BA%94%E3%80%81%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F"><span class="toc-text">十五、生命周期</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#15-1-%E5%BA%94%E7%94%A8%E4%BB%80%E4%B9%88%E5%91%A8%E6%9C%9F%E5%87%BD%E6%95%B0"><span class="toc-text">15.1 应用什么周期函数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#15-2-%E9%A1%B5%E9%9D%A2%E7%9A%84%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E5%87%BD%E6%95%B0"><span class="toc-text">15.2 页面的生命周期函数</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E5%85%AD%E3%80%81wxs"><span class="toc-text">十六、wxs</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#16-1-wxs%E7%9A%84%E5%BA%94%E7%94%A8%E5%9C%BA%E6%99%AF"><span class="toc-text">16.1 wxs的应用场景</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16-2-wxs%E4%B8%8E-js-%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-text">16.2 wxs与 js 的区别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16-3-%E5%86%85%E5%B5%8C-wxs-%E8%84%9A%E6%9C%AC"><span class="toc-text">16.3 内嵌 wxs 脚本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16-4-%E5%AE%9A%E4%B9%89%E5%A4%96%E8%81%94%E7%9A%84-wxs-%E8%84%9A%E6%9C%AC"><span class="toc-text">16.4 定义外联的 wxs 脚本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16-5-%E4%BD%BF%E7%94%A8%E5%A4%96%E8%81%94%E7%9A%84-wxs-%E8%84%9A%E6%9C%AC"><span class="toc-text">16.5 使用外联的 wxs 脚本</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%B8%83%E3%80%81%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6"><span class="toc-text">十七、自定义组件</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#17-1-%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E7%BB%84%E4%BB%B6"><span class="toc-text">17.1 如何创建组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-2%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E7%BB%84%E4%BB%B6"><span class="toc-text">17.2如何使用组件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#17-2-1-%E5%B1%80%E9%83%A8%E5%BC%95%E7%94%A8"><span class="toc-text">17.2.1 局部引用</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-2-2-%E5%85%A8%E5%B1%80%E5%BC%95%E7%94%A8"><span class="toc-text">17.2.2 全局引用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-3-%E7%BB%84%E4%BB%B6%E5%92%8C%E9%A1%B5%E9%9D%A2%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-text">17.3 组件和页面的区别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-4-%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E7%9A%84%E6%A0%B7%E5%BC%8F"><span class="toc-text">17.4 自定义组件的样式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-5-properties-%E5%B1%9E%E6%80%A7"><span class="toc-text">17.5 properties 属性</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-6%E6%95%B0%E6%8D%AE%E7%9B%91%E5%90%AC%E5%99%A8"><span class="toc-text">17.6数据监听器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-7-%E7%BA%AF%E6%95%B0%E6%8D%AE%E5%AD%97%E6%AE%B5"><span class="toc-text">17.7 纯数据字段</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-8-%E7%BB%84%E4%BB%B6%E7%9A%84%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E5%87%BD%E6%95%B0"><span class="toc-text">17.8 组件的生命周期函数</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#17-8-1-lifetimes-%E8%8A%82%E7%82%B9"><span class="toc-text">17.8.1 lifetimes 节点</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-9-%E7%BB%84%E4%BB%B6%E6%89%80%E5%9C%A8%E9%A1%B5%E9%9D%A2%E7%9A%84%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F"><span class="toc-text">17.9 组件所在页面的生命周期</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-10-%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E2%80%94%E6%8F%92%E6%A7%BD"><span class="toc-text">17.10 自定义组件—插槽</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#17-10-1-%E5%8D%95%E4%B8%AA%E6%8F%92%E6%A7%BD"><span class="toc-text">17.10.1 单个插槽</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-10-2-%E5%90%AF%E7%94%A8%E5%A4%9A%E4%B8%AA%E6%8F%92%E6%A7%BD"><span class="toc-text">17.10.2 启用多个插槽</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-10-3-%E5%AE%9A%E4%B9%89%E5%A4%9A%E4%B8%AA%E6%8F%92%E6%A7%BD"><span class="toc-text">17.10.3 定义多个插槽</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-10-4-%E4%BD%BF%E7%94%A8%E5%A4%9A%E4%B8%AA%E6%8F%92%E6%A7%BD"><span class="toc-text">17.10.4 使用多个插槽</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-11-%E7%88%B6%E5%AD%90%E7%BB%84%E4%BB%B6%E4%B9%8B%E9%97%B4%E9%80%9A%E4%BF%A1"><span class="toc-text">17.11 父子组件之间通信</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#17-11-1-%E5%B1%9E%E6%80%A7%E7%BB%91%E5%AE%9A"><span class="toc-text">17.11.1 属性绑定</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-11-2-%E4%BA%8B%E4%BB%B6%E7%BB%91%E5%AE%9A"><span class="toc-text">17.11.2 事件绑定</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-11-3-%E8%8E%B7%E5%8F%96%E7%BB%84%E4%BB%B6%E5%AE%9E%E4%BE%8B"><span class="toc-text">17.11.3 获取组件实例</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-12-%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E2%80%94%E2%80%94-behaviors"><span class="toc-text">17.12 自定义组件——-behaviors</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#17-12-1-%E4%BB%80%E4%B9%88%E6%98%AF-behaviors"><span class="toc-text">17.12.1 什么是 behaviors</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-12-2-behaviors%E7%9A%84%E5%B7%A5%E4%BD%9C%E6%96%B9%E5%BC%8F"><span class="toc-text">17.12.2 behaviors的工作方式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-12-3-%E5%88%9B%E5%BB%BA-behaviors"><span class="toc-text">17.12.3 创建 behaviors</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-12-4-%E5%AF%BC%E5%85%A5%E5%B9%B6%E4%BD%BF%E7%94%A8-behaviors"><span class="toc-text">17.12.4 导入并使用 behaviors</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#17-12-5-behaviors-%E4%B8%AD%E7%9A%84%E5%8F%AF%E7%94%A8%E5%AD%97%E6%AE%B5"><span class="toc-text">17.12.5 behaviors 中的可用字段</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E5%85%AB%E3%80%81npm-%E5%8C%85"><span class="toc-text">十八、npm 包</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#18-1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%AF%B9-npm-%E7%9A%84%E6%94%AF%E6%8C%81%E4%B8%8E%E9%99%90%E5%88%B6"><span class="toc-text">18.1小程序对 npm 的支持与限制</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#18-2-%E5%AE%89%E8%A3%85weapp-%E7%BB%84%E4%BB%B6"><span class="toc-text">18.2 安装weapp 组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#18-3-%E4%BD%BF%E7%94%A8-vant-%E7%BB%84%E4%BB%B6"><span class="toc-text">18.3 使用 vant 组件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%B9%9D%E3%80%81%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A0%B7%E5%BC%8F"><span class="toc-text">十九、自定义样式</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#19-1%E3%80%81%E5%AE%9A%E5%88%B6%E5%85%A8%E5%B1%80%E4%B8%BB%E9%A2%98%E6%A0%B7%E5%BC%8F-vant%E7%9A%84%E4%B8%BB%E9%A2%98%E6%A0%B7%E5%BC%8F"><span class="toc-text">19.1、定制全局主题样式(vant的主题样式)</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C%E5%8D%81%E3%80%81API-promise-%E5%8C%96"><span class="toc-text">二十、API promise 化</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#20-1-%E8%B0%83%E7%94%A8-promise-%E5%8C%96%E5%90%8E%E7%9A%84-API"><span class="toc-text">20.1 调用 promise 化后的 API</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C%E5%8D%81%E4%B8%80%E3%80%81%E5%85%A8%E5%B1%80%E6%95%B0%E6%8D%AE%E5%85%B1%E4%BA%AB"><span class="toc-text">二十一、全局数据共享</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#21-1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E4%B8%AD%E7%9A%84%E5%85%A8%E5%B1%80%E5%85%B1%E4%BA%AB%E6%96%B9%E6%A1%88"><span class="toc-text">21.1小程序中的全局共享方案</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-2-%E5%AE%89%E8%A3%85-MobX-%E5%8C%85"><span class="toc-text">21.2 安装 MobX 包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-3-%E5%88%9B%E5%BB%BA-MobX-%E7%9A%84-Store-%E5%AE%9E%E4%BE%8B"><span class="toc-text">21.3 创建 MobX 的 Store 实例</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-4%E3%80%81%E5%B0%86-stort-%E4%B8%AD%E7%9A%84%E6%88%90%E5%91%98%E7%BB%91%E5%AE%9A%E5%88%B0%E9%A1%B5%E9%9D%A2%E4%B8%AD"><span class="toc-text">21.4、将 stort 中的成员绑定到页面中</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-5%E3%80%81%E5%9C%A8%E9%A1%B5%E9%9D%A2%E4%B8%8A%E4%BD%BF%E7%94%A8-store-%E6%88%90%E5%91%98"><span class="toc-text">21.5、在页面上使用 store 成员</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-6%E3%80%81%E5%B0%86%E7%BB%84%E4%BB%B6%E4%B8%AD%E7%9A%84%E6%88%90%E5%91%98%E7%BB%91%E5%AE%9A%E5%88%B0%E7%BB%84%E4%BB%B6%E4%B8%AD"><span class="toc-text">21.6、将组件中的成员绑定到组件中</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C%E5%8D%81%E4%BA%8C%E3%80%81-%E5%88%86%E5%8C%85"><span class="toc-text">二十二、 分包</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#22-1-%E5%88%86%E5%8C%85%E5%90%8E%E7%9A%84%E9%A1%B9%E7%9B%AE%E6%9E%84%E6%88%90"><span class="toc-text">22.1 分包后的项目构成</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22-2%E3%80%81%E5%88%86%E5%8C%85%E7%9A%84%E5%8A%A0%E8%BD%BD%E8%A7%84%E5%88%99"><span class="toc-text">22.2、分包的加载规则</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22-3%E3%80%81%E5%88%86%E5%8C%85%E7%9A%84%E4%BD%93%E7%A7%AF%E9%99%90%E5%88%B6"><span class="toc-text">22.3、分包的体积限制</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22-4%E3%80%81%E4%BD%BF%E7%94%A8%E5%88%86%E5%8C%85"><span class="toc-text">22.4、使用分包</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#22-4-1%E3%80%81%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95"><span class="toc-text">22.4.1、配置方法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#22-4-2-%E6%89%93%E5%8C%85%E7%9A%84%E5%8E%9F%E5%88%99"><span class="toc-text">22.4.2 打包的原则</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#22-4-3-%E5%BC%95%E7%94%A8%E5%8E%9F%E5%88%99"><span class="toc-text">22.4.3 引用原则</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22-5-%E7%8B%AC%E7%AB%8B%E5%88%86%E5%8C%85"><span class="toc-text">22.5 独立分包</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#22-5-1-%E7%8B%AC%E7%AB%8B%E5%88%86%E5%8C%85%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95"><span class="toc-text">22.5.1 独立分包的配置方法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#22-5-2-%E5%BC%95%E7%94%A8%E5%8E%9F%E5%88%99"><span class="toc-text">22.5.2 引用原则</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22-6%E3%80%81%E5%88%86%E5%8C%85%E9%A2%84%E4%B8%8B%E8%BD%BD"><span class="toc-text">22.6、分包预下载</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#22-6-1%E9%85%8D%E7%BD%AE%E5%88%86%E5%8C%85%E9%A2%84%E4%B8%8B%E8%BD%BD"><span class="toc-text">22.6.1配置分包预下载</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#22-6-2-%E5%88%86%E5%8C%85%E9%A2%84%E4%B8%8B%E8%BD%BD%E7%9A%84%E9%99%90%E5%88%B6"><span class="toc-text">22.6.2 分包预下载的限制</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C%E5%8D%81%E4%B8%89%E3%80%81%E5%B0%8F%E6%A1%88%E4%BE%8B%E2%80%94-%E8%87%AA%E5%AE%9A%E4%B9%89tabBar"><span class="toc-text">二十三、小案例—-自定义tabBar</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#23-1-%E8%A6%86%E7%9B%96-vant-%E7%9A%84%E6%A0%B7%E5%BC%8F"><span class="toc-text">23.1 覆盖 vant 的样式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#23-2-%E7%BB%84%E4%BB%B6%E8%B0%83%E7%94%A8mobx"><span class="toc-text">23.2 组件调用mobx</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#23-3-%E5%88%87%E6%8D%A2tabBar%E7%9A%84%E6%97%B6%E5%80%99-%E5%88%87%E6%8D%A2%E9%A1%B5%E9%9D%A2"><span class="toc-text">23.3 切换tabBar的时候 切换页面</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#23-4-%E4%BF%AE%E6%94%B9tabBar%E9%80%89%E4%B8%AD%E6%96%87%E6%9C%AC%E9%A2%9C%E8%89%B2"><span class="toc-text">23.4 修改tabBar选中文本颜色</span></a></li></ol></li></ol>
    </div>
  </section>

  

</div>


<!-- 没有 pjax 占位会报错 万恶的 pjax -->

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <div class="pjax">
    <!-- pjax占位 -->
  </div>

  <!-- Custom Files side begin -->
  
  <!-- Custom Files side end -->
</aside>



          <!--此文件用来存放一些不方便取值的变量-->
<!--思路大概是将值藏到重加载的区域内-->

<pjax>
<script>
  window.pdata={}
  pdata.ispage=true;
  pdata.commentPath="";
  pdata.commentPlaceholder="";
  pdata.commentConfig={};
  //  see: /layout/_partial/scripts/_ctrl/coverCtrl.ejs
  
    // header
    var l_header=document.getElementById("l_header");
    
    l_header.classList.add("show");
    
    
      // cover
      var cover_wrapper=document.querySelector('#l_cover .cover-wrapper');
      var scroll_down=document.getElementById('scroll-down');
      cover_wrapper.id="none";
      cover_wrapper.style.display="none";
      scroll_down.style.display="none";
    
  
</script>
</pjax>
        </div>
        
  
  <footer class="footer clearfix"  itemscope itemtype="http://schema.org/WPFooter">
    <br><br>
    
      
        <br>
        <div class="social-wrapper" itemprop="about" itemscope itemtype="http://schema.org/Thing">
          
            
          
            
          
            
          
        </div>
      
    
      
        <div><p>博客内容遵循 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</a></p>
</div>
      
    
      
        <div class='copyright'>
        <p><a href="/">Copyright © 2023 小新</a></p>

        </div>
      
    
      
        
          <div><p><a href="/"><a class="nav-link" target="_blank" href="https://beian.miit.gov.cn/"> <img style="margin-top: -4px" src="" alt="我是中国人！"/>豫ICP备2021022453号 </a></a></p>
</div>
        
      
    
    <!-- Custom Files footer begin-->
    
    <!-- Custom Files footer end-->
  </footer>


        <a id="s-top" class="fa-solid fa-arrow-up fa-fw" href="/" onclick="return false;" title="top"></a>
      </div>
    </div>
    <div>
      <script>
  /******************** volantis.dom ********************************/
  // 页面选择器 将dom对象缓存起来 see: /source/js/app.js etc.
  volantis.dom.bodyAnchor = volantis.dom.$(document.getElementById("safearea")); // 页面主体
  volantis.dom.topBtn = volantis.dom.$(document.getElementById('s-top')); // 向上
  volantis.dom.wrapper = volantis.dom.$(document.getElementById('wrapper')); // 整个导航栏
  volantis.dom.coverAnchor = volantis.dom.$(document.querySelector('#l_cover .cover-wrapper')); // 1个
  volantis.dom.switcher = volantis.dom.$(document.querySelector('#l_header .switcher .s-search')); // 搜索按钮   移动端 1个
  volantis.dom.header = volantis.dom.$(document.getElementById('l_header')); // 移动端导航栏
  volantis.dom.search = volantis.dom.$(document.querySelector('#l_header .m_search')); // 搜索框 桌面端 移动端 1个
  volantis.dom.mPhoneList = volantis.dom.$(document.querySelectorAll('#l_header .m-phone .list-v')); //  手机端 子菜单 多个
</script>

<script>
  
  volantis.css("https://unpkg.com/volantis-static@0.0.1654736714924/libs/@fortawesome/fontawesome-free/css/all.min.css");
  
  
  
</script>

<!-- required -->


<!-- internal -->

<script src="/js/app.js"></script>






<!-- rightmenu要在darkmode之前（ToggleButton） darkmode要在comments之前（volantis.dark.push）-->



<script>
  function loadIssuesJS() {
    
      const sites_api = document.getElementById('sites-api');
      if (sites_api != undefined && typeof SitesJS === 'undefined') {
        volantis.js("/js/plugins/tags/sites.js")
      }
    
    
      const friends_api = document.getElementById('friends-api');
      if (friends_api != undefined && typeof FriendsJS === 'undefined') {
        volantis.js("/js/plugins/tags/friends.js")
      }
    
    
      const contributors_api = document.getElementById('contributors-api');
      if (contributors_api != undefined && typeof ContributorsJS === 'undefined') {
        volantis.js("/js/plugins/tags/contributors.js")
      }
    
  };
  loadIssuesJS()
  volantis.pjax.push(()=>{
    loadIssuesJS();
  })

</script>




  <script defer src="https://unpkg.com/volantis-static@0.0.1654736714924/libs/vanilla-lazyload/dist/lazyload.min.js"></script>
<script>
  // https://www.npmjs.com/package/vanilla-lazyload
  // Set the options globally
  // to make LazyLoad self-initialize
  window.lazyLoadOptions = {
    elements_selector: ".lazyload",
    threshold: 0
  };
  // Listen to the initialization event
  // and get the instance of LazyLoad
  window.addEventListener(
    "LazyLoad::Initialized",
    function (event) {
      window.lazyLoadInstance = event.detail.instance;
    },
    false
  );
  document.addEventListener('DOMContentLoaded', function () {
    lazyLoadInstance.update();
  });
  document.addEventListener('pjax:complete', function () {
    lazyLoadInstance.update();
  });
</script>




  

<script>
  window.FPConfig = {
	delay: 0,
	ignoreKeywords: ["#"],
	maxRPS: 6,
	hoverDelay: 0
  };
</script>
<script defer src="https://unpkg.com/volantis-static@0.0.1654736714924/libs/flying-pages/flying-pages.min.js"></script>







  <script>
  volantis.css("https://unpkg.com/volantis-static@0.0.1654736714924/libs/aplayer/dist/APlayer.min.css");
  (async () => {
    // APlayer 需要在  MetingJS 之前加载
    await volantis.js("https://unpkg.com/volantis-static@0.0.1654736714924/libs/aplayer/dist/APlayer.min.js")
    await volantis.js("https://unpkg.com/volantis-static@0.0.1654736714924/libs/meting/dist/Meting.min.js")
  
  })();

  function SetAPlayerPlugin(){
    let Metings = document.querySelectorAll('meting-js');
    if (Metings.length === 0) {return;};
    if (Metings[0].aplayer && Metings[0].aplayer.on) {
      // improve the accessibility https://web.dev/button-name/
      document.querySelectorAll(".aplayer-icon-menu").forEach(e=>{
        e.setAttribute("aria-label","Aplayer Menu")
      })
      // message see: /layout/_plugins/message/script.ejs
      
        try {
          setTimeout(() => {
            Metings.forEach((item, index) => {
              const aplayerItem = item.aplayer; if(!aplayerItem) return;
              const rightAplayerCheck = 'true' === 'true'
                && item.meta.id === '3175833810';
              if(rightAplayerCheck && typeof RightMenuAplayer !="undefined") RightMenuAplayer.checkAPlayer();
              if(aplayerItem.events.events.play.every(item => {return item.name !== 'messagePlay'})) {
                aplayerItem.on('play', function messagePlay() {
                  let index = aplayerItem.list.index;
                  let title = aplayerItem.list.audios[index].title;
                  let artist = aplayerItem.list.audios[index].artist;
                  setTimeout(() => {
                    VolantisApp.message('音乐通知', title + ' - ' + artist, {
                      icon: 'fa-solid fa-play',
                      transitionIn: 'flipInX',
                      transitionOut: 'flipOutX'
                    });
                  }, 100)
                });
              }
              if(aplayerItem.events.events.pause.every(item => {return item.name !== 'messagePause'})) {
                aplayerItem.on('pause', function messagePause() {
                  let index = aplayerItem.list.index;
                  let title = aplayerItem.list.audios[index].title;
                  let artist = aplayerItem.list.audios[index].artist;
                  setTimeout(() => {
                    // 歌曲播放结束也会触发 pause 事件，为了避免错误提示，等待一会儿
                    if(aplayerItem.paused) {
                      VolantisApp.message('音乐通知', title + ' - ' + artist, {
                        icon: 'fa-solid fa-pause',
                        transitionIn: 'flipInX',
                        transitionOut: 'flipOutX'
                      });
                    }
                  }, 100)
                });
              }
            });
          }, 500)
        } catch (error) { console.error(error); }
      
    }else{
      volantis.requestAnimationFrame(SetAPlayerPlugin)
    }
  }

  document.addEventListener("DOMContentLoaded", ()=>{
    SetAPlayerPlugin();
  });
  volantis.pjax.push(SetAPlayerPlugin);
</script>




      <script>
  volantis.layoutHelper("comments",`<div id="lv-container" data-id="city" data-uid="MTAyMC81MzYzMC8zMDEwMw==">
  <noscript><div><i class='fa-solid fa-exclamation-triangle'>&nbsp;无法加载 Livere 评论系统，请确保您的网络能够正常访问。</div></noscript>
</div>`)
</script>
<script data-pjax type="text/javascript">
  (function(d, s) {
    var j, e = d.getElementsByTagName(s)[0];
    if (typeof LivereTower === 'function') { return; }
    j = d.createElement(s);
    j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
    j.async = true;
    e.parentNode.insertBefore(j, e);
  })(document, 'script');

</script>
<script>
  let volanB = document.getElementById('taboola-livere')
  volanB.setAttribute("style","#taboola-livere { display: none;}");
</script>

    





<!-- optional -->

  <script>
  const SearchServiceDataPathRoot = ("/" || "/").endsWith("/") ?
    "/" || "/" :
    "//" || "/";
  const SearchServiceDataPath = SearchServiceDataPathRoot + "content.json";

  function loadSearchScript() {
    // see: layout/_partial/scripts/_ctrl/cdnCtrl.ejs
    return volantis.js("/js/search/hexo.js");
  }

  function loadSearchService() {
    loadSearchScript();
    document.querySelectorAll(".input.u-search-input").forEach((e) => {
      e.removeEventListener("focus", loadSearchService, false);
    });

    document.querySelectorAll(".u-search-form").forEach((e) => {
      e.addEventListener("submit", (event) => {
        event.preventDefault();
      }, false);
    });
  }

  // 打开并搜索 字符串 s
  function OpenSearch(s) {
    if (typeof SearchService === 'undefined')
      loadSearchScript().then(() => {
        SearchService.setQueryText(s);
        SearchService.search();
      });
    else {
      SearchService.setQueryText(s);
      SearchService.search();
    }
  }

  // 访问含有 ?s=xxx  的链接时打开搜索 // 与搜索引擎 structured data 相关: /scripts/helpers/structured-data/lib/config.js
  if (window.location.search && /^\?s=/g.test(window.location.search)) {
    let queryText = decodeURI(window.location.search)
      .replace(/\ /g, "-")
      .replace(/^\?s=/g, "");
    OpenSearch(queryText);
  }

  // 搜索输入框获取焦点时加载搜索
  document.querySelectorAll(".input.u-search-input").forEach((e) => {
    e.addEventListener("focus", loadSearchService, false);
  });
</script>







  <script>



  function pjax_highlightjs_copyCode(){
    if (!(document.querySelector(".highlight .code pre") ||
      document.querySelector(".article pre code"))) {
      return;
    }
    VolantisApp.utilCopyCode(".highlight .code pre, .article pre code")
  }
  volantis.requestAnimationFrame(pjax_highlightjs_copyCode)
  volantis.pjax.push(pjax_highlightjs_copyCode)

</script>












  <script>
  function load_swiper() {
    if (!document.querySelectorAll(".swiper-container")[0]) return;
    volantis.css("https://unpkg.com/volantis-static@0.0.1654736714924/libs/swiper/swiper-bundle.min.css");
    volantis.js("https://unpkg.com/volantis-static@0.0.1654736714924/libs/swiper/swiper-bundle.min.js").then(() => {
      pjax_swiper();
    });
  }

  load_swiper();

  function pjax_swiper() {
    volantis.swiper = new Swiper('.swiper-container', {
      slidesPerView: 'auto',
      spaceBetween: 8,
      centeredSlides: true,
      loop: true,
      pagination: {
        el: '.swiper-pagination',
        clickable: true,
      },
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
  }

  volantis.pjax.push(() => {
    if (!document.querySelectorAll(".swiper-container")[0]) return;
    if (typeof volantis.swiper === "undefined") {
      load_swiper();
    } else {
      pjax_swiper();
    }
  });
</script>


<!-- pjax 标签必须存在于所有页面 否则 pjax error -->
<pjax>

</pjax>

<script>
  function listennSidebarTOC() {
    const navItems = document.querySelectorAll(".toc li");
    if (!navItems.length) return;
    let targets = []
    const sections = [...navItems].map((element) => {
      const link = element.querySelector(".toc-link");
      const target = document.getElementById(
        decodeURI(link.getAttribute("href")).replace("#", "")
      );
      targets.push(target)
      // 解除 a 标签 href 的 锚点定位, a 标签 href 的 锚点定位 会随机启用?? 产生错位???
      link.setAttribute("onclick","return false;")
      link.setAttribute("toc-action","toc-"+decodeURI(link.getAttribute("href")).replace("#", ""))
      link.setAttribute("href","/")
      // 配置 点击 触发新的锚点定位
      link.addEventListener("click", (event) => {
        event.preventDefault();
        // 这里的 addTop 是通过错位使得 toc 自动展开.
        volantis.scroll.to(target,{addTop: 5, observer:true})
        // Anchor id
        history.pushState(null, document.title, "#" + target.id);
      });
      return target;
    });

    function activateNavByIndex(target) {
      if (target.classList.contains("active-current")) return;

      document.querySelectorAll(".toc .active").forEach((element) => {
        element.classList.remove("active", "active-current");
      });
      target.classList.add("active", "active-current");
      let parent = target.parentNode;
      while (!parent.matches(".toc")) {
        if (parent.matches("li")) parent.classList.add("active");
        parent = parent.parentNode;
      }
    }

    // 方案一：
    volantis.activateNavIndex=0
    activateNavByIndex(navItems[volantis.activateNavIndex])
    volantis.scroll.push(()=>{
      if (targets[0].getBoundingClientRect().top >= 0) {
        volantis.activateNavIndex = 0
      }else if (targets[targets.length-1].getBoundingClientRect().top < 0) {
        volantis.activateNavIndex = targets.length-1
      } else {
        for (let index = 0; index < targets.length; index++) {
          const target0 = targets[index];
          const target1 = targets[(index+1)%targets.length];
          if (target0.getBoundingClientRect().top < 0&&target1.getBoundingClientRect().top >= 0) {
            volantis.activateNavIndex=index
            break;
          }
        }
      }
      activateNavByIndex(navItems[volantis.activateNavIndex])
    })

    // 方案二：
    // IntersectionObserver 不是完美精确到像素级别 也不是低延时性的
    // function findIndex(entries) {
    //   let index = 0;
    //   let entry = entries[index];
    //   if (entry.boundingClientRect.top > 0) {
    //     index = sections.indexOf(entry.target);
    //     return index === 0 ? 0 : index - 1;
    //   }
    //   for (; index < entries.length; index++) {
    //     if (entries[index].boundingClientRect.top <= 0) {
    //       entry = entries[index];
    //     } else {
    //       return sections.indexOf(entry.target);
    //     }
    //   }
    //   return sections.indexOf(entry.target);
    // }
    // function createIntersectionObserver(marginTop) {
    //   marginTop = Math.floor(marginTop + 10000);
    //   let intersectionObserver = new IntersectionObserver(
    //     (entries, observe) => {
    //       let scrollHeight = document.documentElement.scrollHeight;
    //       if (scrollHeight > marginTop) {
    //         observe.disconnect();
    //         createIntersectionObserver(scrollHeight);
    //         return;
    //       }
    //       let index = findIndex(entries);
    //       activateNavByIndex(navItems[index]);
    //     }, {
    //       rootMargin: marginTop + "px 0px -100% 0px",
    //       threshold: 0,
    //     }
    //   );
    //   sections.forEach((element) => {
    //     element && intersectionObserver.observe(element);
    //   });
    // }
    // createIntersectionObserver(document.documentElement.scrollHeight);
  }

  document.addEventListener("DOMContentLoaded", ()=>{
    volantis.requestAnimationFrame(listennSidebarTOC)
  });
  document.addEventListener("pjax:success", ()=>{
    volantis.requestAnimationFrame(listennSidebarTOC)
  });
</script>



<script>
  document.onreadystatechange = function () {
    if (document.readyState == 'complete') {
      // 页面加载完毕 样式加载失败，或是当前网速慢，或是开启了省流模式
      const { saveData, effectiveType } = navigator.connection || navigator.mozConnection || navigator.webkitConnection || {}
      if (getComputedStyle(document.querySelector("#safearea"), null)["display"] == "none" || saveData || /2g/.test(effectiveType)) {
        document.querySelectorAll(".reveal").forEach(function (e) {
          e.style["opacity"] = "1";
        });
        document.querySelector("#safearea").style["display"] = "block";
      }
    }
  }
</script>


  <script type="application/ld+json">[{"@context":"http://schema.org","@type":"Organization","name":"小新的记事本","url":"https://wyzqy.gitee.io/","logo":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png","width":192,"height":192}},{"@context":"http://schema.org","@type":"Person","name":"Mdream","image":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png"},"url":"https://wyzqy.gitee.io/","sameAs":["https://github.com/volantis-x"],"description":"前端技术爱好者"},{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https://wyzqy.gitee.io/","name":"小新的记事本"}},{"@type":"ListItem","position":2,"item":{"@id":"https://wyzqy.gitee.io/categories/笔记/","name":"笔记"}},{"@type":"ListItem","position":3,"item":{"@id":"https://wyzqy.gitee.io/2023/07/07/小程序笔记/","name":"小程序笔记"}}]},{"@context":"http://schema.org","@type":"WebSite","name":"小新的记事本","url":"https://wyzqy.gitee.io/","keywords":null,"description":"前端技术爱好者","author":{"@type":"Person","name":"Mdream","image":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png"},"url":"https://wyzqy.gitee.io/","description":"前端技术爱好者"},"publisher":{"@type":"Organization","name":"小新的记事本","url":"https://wyzqy.gitee.io/","logo":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png","width":192,"height":192}},"potentialAction":{"@type":"SearchAction","name":"Site Search","target":{"@type":"EntryPoint","urlTemplate":"https://wyzqy.gitee.io?s={search_term_string}"},"query-input":"required name=search_term_string"}},{"@context":"http://schema.org","@type":"BlogPosting","headline":"小程序笔记","description":"原生小程序笔记记录，所有的内容都在于此，一起来学习一下吧~","inLanguage":"zh-CN","mainEntityOfPage":{"@type":"WebPage","@id":"https://wyzqy.gitee.io/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/"},"author":{"@type":"Person","name":"Mdream","image":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png"},"url":"https://wyzqy.gitee.io/"},"publisher":{"@type":"Organization","name":"小新的记事本","logo":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png","width":192,"height":192}},"url":"https://wyzqy.gitee.io/2023/07/07/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%AC%94%E8%AE%B0/","wordCount":29,"datePublished":"2023-07-07T06:25:00.000Z","dateModified":"2023-07-07T07:29:28.724Z","articleSection":"笔记","keywords":"笔记,小程序","image":{"@type":"ImageObject","url":"https://unpkg.com/volantis-static@0.0.1654736714924/media/org.volantis/blog/favicon/android-chrome-192x192.png","width":192,"height":192}}]</script>



      
        <!--
  pjax重载区域接口：
  1.  <pjax></pjax> 标签 pjax 标签必须存在于所有页面 否则 pjax error
  2.  script[data-pjax]
  3.  .pjax-reload script
  4.  .pjax
-->



<script src="https://unpkg.com/volantis-static@0.0.1654736714924/libs/pjax/pjax.min.js"></script>


<script>
    var pjax;
    document.addEventListener('DOMContentLoaded', function () {
      pjax = new Pjax({
        elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([pjax-fancybox]):not([onclick="return false;"]):not([onclick="return!1"]):not([target="_blank"]):not([target="view_window"]):not([href$=".xml"])',
        selectors: [
          "head title",
          "head meta[name=keywords]",
          "head meta[name=description]",
          
          "#l_main",
          "#pjax-header-nav-list",
          ".pjax",
          "pjax", // <pjax></pjax> 标签
          "script[data-pjax], .pjax-reload script" // script标签添加data-pjax 或 script标签外层添加.pjax-reload 的script代码段重载
        ],
        cacheBust: false,   // url 地址追加时间戳，用以避免浏览器缓存
        timeout: 5000,
        
      });
    });

    document.addEventListener('pjax:send', function (e) {
      //window.stop(); // 相当于点击了浏览器的停止按钮

      try {
        var currentUrl = window.location.pathname;
        var targetUrl = e.triggerElement.href;
        var banUrl = [""];
        if (banUrl[0] != "") {
          banUrl.forEach(item => {
            if(currentUrl.indexOf(item) != -1 || targetUrl.indexOf(item) != -1) {
              window.location.href = targetUrl;
            }
          });
        }
      } catch (error) {}

      // 使用 volantis.pjax.send 方法传入pjax:send回调函数 参见layout/_partial/scripts/global.ejs
      volantis.pjax.method.send.start();
    });

    document.addEventListener('pjax:complete', function () {
      // 使用 volantis.pjax.push 方法传入重载函数 参见layout/_partial/scripts/global.ejs
      volantis.pjax.method.complete.start();
    });

    document.addEventListener('pjax:error', function (e) {
      if(volantis.debug) {
        console.error(e);
        console.log('pjax error: \n' + JSON.stringify(e));
      }else{
        // 使用 volantis.pjax.error 方法传入pjax:error回调函数 参见layout/_partial/scripts/global.ejs
        volantis.pjax.method.error.start();
        window.location.href = e.triggerElement.href;
      }
    });
</script>

      
    </div>
    <!-- import body_end begin-->
    <!-- import body_end end-->
    <!-- Custom Files bodyEnd begin-->
    
    <!-- Custom Files bodyEnd end-->
    <!-- front-matter body_end begin -->
    <!-- front-matter body_end end -->
  </body>
</html>
